aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-28 17:30:59 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-06-29 14:56:35 +0200
commitd4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch)
treea4cb07318100031951c3dffc61f4f2cb95d2cbd0 /client/src/app/shared/shared-main
parent62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff)
downloadPeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip
Support short uuid for GET video/playlist
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/angular/link.component.ts2
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.model.ts3
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts15
3 files changed, 16 insertions, 4 deletions
diff --git a/client/src/app/shared/shared-main/angular/link.component.ts b/client/src/app/shared/shared-main/angular/link.component.ts
index 76d1201b9..597a16871 100644
--- a/client/src/app/shared/shared-main/angular/link.component.ts
+++ b/client/src/app/shared/shared-main/angular/link.component.ts
@@ -6,7 +6,7 @@ import { Component, Input, ViewEncapsulation } from '@angular/core'
6 templateUrl: './link.component.html' 6 templateUrl: './link.component.html'
7}) 7})
8export class LinkComponent { 8export class LinkComponent {
9 @Input() internalLink?: any[] 9 @Input() internalLink?: string | any[]
10 10
11 @Input() href?: string 11 @Input() href?: string
12 @Input() target?: string 12 @Input() target?: string
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts
index c80bc13b0..4c15eb981 100644
--- a/client/src/app/shared/shared-main/users/user-notification.model.ts
+++ b/client/src/app/shared/shared-main/users/user-notification.model.ts
@@ -12,6 +12,7 @@ import {
12 UserRight, 12 UserRight,
13 VideoInfo 13 VideoInfo
14} from '@shared/models' 14} from '@shared/models'
15import { Video } from '../video'
15 16
16export class UserNotification implements UserNotificationServer { 17export class UserNotification implements UserNotificationServer {
17 id: number 18 id: number
@@ -238,7 +239,7 @@ export class UserNotification implements UserNotificationServer {
238 } 239 }
239 240
240 private buildVideoUrl (video: { uuid: string }) { 241 private buildVideoUrl (video: { uuid: string }) {
241 return '/w/' + video.uuid 242 return Video.buildWatchUrl(video)
242 } 243 }
243 244
244 private buildAccountUrl (account: { name: string, host: string }) { 245 private buildAccountUrl (account: { name: string, host: string }) {
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index ab8ed9051..f0a4a3f37 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -26,12 +26,18 @@ export class Video implements VideoServerModel {
26 licence: VideoConstant<number> 26 licence: VideoConstant<number>
27 language: VideoConstant<string> 27 language: VideoConstant<string>
28 privacy: VideoConstant<VideoPrivacy> 28 privacy: VideoConstant<VideoPrivacy>
29
29 description: string 30 description: string
31
30 duration: number 32 duration: number
31 durationLabel: string 33 durationLabel: string
34
32 id: number 35 id: number
33 uuid: string 36 uuid: string
37 shortUUID: string
38
34 isLocal: boolean 39 isLocal: boolean
40
35 name: string 41 name: string
36 serverHost: string 42 serverHost: string
37 thumbnailPath: string 43 thumbnailPath: string
@@ -85,8 +91,12 @@ export class Video implements VideoServerModel {
85 91
86 pluginData?: any 92 pluginData?: any
87 93
88 static buildClientUrl (videoUUID: string) { 94 static buildWatchUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
89 return '/w/' + videoUUID 95 return '/w/' + (video.shortUUID || video.uuid)
96 }
97
98 static buildUpdateUrl (video: Pick<Video, 'uuid'>) {
99 return '/videos/update/' + video.uuid
90 } 100 }
91 101
92 constructor (hash: VideoServerModel, translations = {}) { 102 constructor (hash: VideoServerModel, translations = {}) {
@@ -109,6 +119,7 @@ export class Video implements VideoServerModel {
109 119
110 this.id = hash.id 120 this.id = hash.id
111 this.uuid = hash.uuid 121 this.uuid = hash.uuid
122 this.shortUUID = hash.shortUUID
112 123
113 this.isLocal = hash.isLocal 124 this.isLocal = hash.isLocal
114 this.name = hash.name 125 this.name = hash.name