diff options
Diffstat (limited to 'client/src/app')
25 files changed, 86 insertions, 54 deletions
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index 63143d0f9..08500ef5c 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -122,7 +122,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit { | |||
122 | } | 122 | } |
123 | 123 | ||
124 | getVideoUrl (videoBlock: VideoBlacklist) { | 124 | getVideoUrl (videoBlock: VideoBlacklist) { |
125 | return Video.buildClientUrl(videoBlock.video.uuid) | 125 | return Video.buildWatchUrl(videoBlock.video) |
126 | } | 126 | } |
127 | 127 | ||
128 | toHtml (text: string) { | 128 | toHtml (text: string) { |
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts index bb9d70524..68254526a 100644 --- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts +++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { VideoImportService } from '@app/shared/shared-main' | 4 | import { Video, VideoImportService } from '@app/shared/shared-main' |
5 | import { VideoImport, VideoImportState } from '@shared/models' | 5 | import { VideoImport, VideoImportState } from '@shared/models' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
@@ -55,11 +55,11 @@ export class MyVideoImportsComponent extends RestTable implements OnInit { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | getVideoUrl (video: { uuid: string }) { | 57 | getVideoUrl (video: { uuid: string }) { |
58 | return '/w/' + video.uuid | 58 | return Video.buildWatchUrl(video) |
59 | } | 59 | } |
60 | 60 | ||
61 | getEditVideoUrl (video: { uuid: string }) { | 61 | getEditVideoUrl (video: { uuid: string }) { |
62 | return '/videos/update/' + video.uuid | 62 | return Video.buildUpdateUrl(video) |
63 | } | 63 | } |
64 | 64 | ||
65 | protected reloadData () { | 65 | protected reloadData () { |
diff --git a/client/src/app/+remote-interaction/remote-interaction.component.ts b/client/src/app/+remote-interaction/remote-interaction.component.ts index 6ddf5b58d..293f7edad 100644 --- a/client/src/app/+remote-interaction/remote-interaction.component.ts +++ b/client/src/app/+remote-interaction/remote-interaction.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { forkJoin } from 'rxjs' | 1 | import { forkJoin } from 'rxjs' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { VideoChannel } from '@app/shared/shared-main' | 4 | import { Video, VideoChannel } from '@app/shared/shared-main' |
5 | import { SearchService } from '@app/shared/shared-search' | 5 | import { SearchService } from '@app/shared/shared-search' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
@@ -39,7 +39,7 @@ export class RemoteInteractionComponent implements OnInit { | |||
39 | if (videoResult.data.length !== 0) { | 39 | if (videoResult.data.length !== 0) { |
40 | const video = videoResult.data[0] | 40 | const video = videoResult.data[0] |
41 | 41 | ||
42 | redirectUrl = '/w/' + video.uuid | 42 | redirectUrl = Video.buildWatchUrl(video) |
43 | } else if (channelResult.data.length !== 0) { | 43 | } else if (channelResult.data.length !== 0) { |
44 | const channel = new VideoChannel(channelResult.data[0]) | 44 | const channel = new VideoChannel(channelResult.data[0]) |
45 | 45 | ||
diff --git a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts b/client/src/app/+search/shared/abstract-lazy-load.resolver.ts index 31240f451..b18a5b64d 100644 --- a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts +++ b/client/src/app/+search/shared/abstract-lazy-load.resolver.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { map } from 'rxjs/operators' | 2 | import { map } from 'rxjs/operators' |
3 | import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router' | 3 | import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router' |
4 | import { ResultList } from '@shared/models/result-list.model' | 4 | import { ResultList } from '@shared/models' |
5 | 5 | ||
6 | export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> { | 6 | export abstract class AbstractLazyLoadResolver <T> implements Resolve<any> { |
7 | protected router: Router | 7 | protected router: Router |
diff --git a/client/src/app/+search/shared/playlist-lazy-load.resolver.ts b/client/src/app/+search/shared/playlist-lazy-load.resolver.ts index 14ae798df..3310e9627 100644 --- a/client/src/app/+search/shared/playlist-lazy-load.resolver.ts +++ b/client/src/app/+search/shared/playlist-lazy-load.resolver.ts | |||
@@ -19,6 +19,6 @@ export class PlaylistLazyLoadResolver extends AbstractLazyLoadResolver<VideoPlay | |||
19 | } | 19 | } |
20 | 20 | ||
21 | protected buildUrl (playlist: VideoPlaylist) { | 21 | protected buildUrl (playlist: VideoPlaylist) { |
22 | return '/w/p/' + playlist.uuid | 22 | return VideoPlaylist.buildWatchUrl(playlist) |
23 | } | 23 | } |
24 | } | 24 | } |
diff --git a/client/src/app/+search/shared/video-lazy-load.resolver.ts b/client/src/app/+search/shared/video-lazy-load.resolver.ts index 12b5b2e82..69a3eb159 100644 --- a/client/src/app/+search/shared/video-lazy-load.resolver.ts +++ b/client/src/app/+search/shared/video-lazy-load.resolver.ts | |||
@@ -19,6 +19,6 @@ export class VideoLazyLoadResolver extends AbstractLazyLoadResolver<Video> { | |||
19 | } | 19 | } |
20 | 20 | ||
21 | protected buildUrl (video: Video) { | 21 | protected buildUrl (video: Video) { |
22 | return '/w/' + video.uuid | 22 | return Video.buildWatchUrl(video) |
23 | } | 23 | } |
24 | } | 24 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index 4c39b276a..01c9fcb16 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | 1 | ||
2 | import { forkJoin } from 'rxjs' | 2 | import { forkJoin } from 'rxjs' |
3 | import { AfterViewChecked, AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' | 3 | import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' |
4 | import { Router } from '@angular/router' | 4 | import { Router } from '@angular/router' |
5 | import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' | 5 | import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' |
6 | import { scrollToTop } from '@app/helpers' | 6 | import { scrollToTop } from '@app/helpers' |
7 | import { FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService } from '@app/shared/shared-forms' |
8 | import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LiveVideoService } from '@app/shared/shared-video-live' | 9 | import { LiveVideoService } from '@app/shared/shared-video-live' |
10 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models' | 11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models' |
@@ -127,7 +127,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
127 | () => { | 127 | () => { |
128 | this.notifier.success($localize`Live published.`) | 128 | this.notifier.success($localize`Live published.`) |
129 | 129 | ||
130 | this.router.navigate(['/w', video.uuid]) | 130 | this.router.navigateByUrl(Video.buildWatchUrl(video)) |
131 | }, | 131 | }, |
132 | 132 | ||
133 | err => { | 133 | err => { |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index f383662a1..ec027f257 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -1,16 +1,16 @@ | |||
1 | import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' | ||
2 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' | ||
1 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 3 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 4 | import { Router } from '@angular/router' |
3 | import { UploadxOptions, UploadState, UploadxService } from 'ngx-uploadx' | ||
4 | import { UploaderXFormData } from './uploaderx-form-data' | ||
5 | import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core' | 5 | import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core' |
6 | import { scrollToTop, genericUploadErrorHandler } from '@app/helpers' | 6 | import { genericUploadErrorHandler, scrollToTop } from '@app/helpers' |
7 | import { FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService } from '@app/shared/shared-forms' |
8 | import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | 10 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' |
11 | import { VideoPrivacy } from '@shared/models' | 11 | import { VideoPrivacy } from '@shared/models' |
12 | import { UploaderXFormData } from './uploaderx-form-data' | ||
12 | import { VideoSend } from './video-send' | 13 | import { VideoSend } from './video-send' |
13 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' | ||
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
16 | selector: 'my-video-upload', | 16 | selector: 'my-video-upload', |
@@ -243,7 +243,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
243 | this.isUploadingVideo = false | 243 | this.isUploadingVideo = false |
244 | 244 | ||
245 | this.notifier.success($localize`Video published.`) | 245 | this.notifier.success($localize`Video published.`) |
246 | this.router.navigate([ '/w', video.uuid ]) | 246 | this.router.navigateByUrl(Video.buildWatchUrl(video)) |
247 | }, | 247 | }, |
248 | 248 | ||
249 | err => { | 249 | err => { |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.html b/client/src/app/+videos/+video-edit/video-update.component.html index 9629081e3..33e3ddd14 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.html +++ b/client/src/app/+videos/+video-edit/video-update.component.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <div class="margin-content"> | 1 | <div class="margin-content"> |
2 | <div class="title-page title-page-single"> | 2 | <div class="title-page title-page-single"> |
3 | <span class="mr-1" i18n>Update</span> | 3 | <span class="mr-1" i18n>Update</span> |
4 | <a [routerLink]="[ '/w', video.uuid ]">{{ video?.name }}</a> | 4 | <a [routerLink]="getVideoUrl()">{{ video?.name }}</a> |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <form novalidate [formGroup]="form"> | 7 | <form novalidate [formGroup]="form"> |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 574669a23..1534eee82 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -5,7 +5,7 @@ import { Component, HostListener, OnInit } from '@angular/core' | |||
5 | import { ActivatedRoute, Router } from '@angular/router' | 5 | import { ActivatedRoute, Router } from '@angular/router' |
6 | import { Notifier } from '@app/core' | 6 | import { Notifier } from '@app/core' |
7 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
8 | import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LiveVideoService } from '@app/shared/shared-video-live' | 9 | import { LiveVideoService } from '@app/shared/shared-video-live' |
10 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' | 11 | import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' |
@@ -156,7 +156,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
156 | this.isUpdatingVideo = false | 156 | this.isUpdatingVideo = false |
157 | this.loadingBar.useRef().complete() | 157 | this.loadingBar.useRef().complete() |
158 | this.notifier.success($localize`Video updated.`) | 158 | this.notifier.success($localize`Video updated.`) |
159 | this.router.navigate([ '/w', this.video.uuid ]) | 159 | this.router.navigateByUrl(Video.buildWatchUrl(this.video)) |
160 | }, | 160 | }, |
161 | 161 | ||
162 | err => { | 162 | err => { |
@@ -175,4 +175,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
175 | pluginData: this.video.pluginData | 175 | pluginData: this.video.pluginData |
176 | }) | 176 | }) |
177 | } | 177 | } |
178 | |||
179 | getVideoUrl () { | ||
180 | return Video.buildWatchUrl(this.videoDetails) | ||
181 | } | ||
178 | } | 182 | } |
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/comment/video-comment.component.html index 06548edc8..d8b944b35 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.html +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | </a> | 20 | </a> |
21 | </div> | 21 | </div> |
22 | 22 | ||
23 | <a [routerLink]="['/w', video.uuid, { 'threadId': comment.threadId }]" class="comment-date" [title]="comment.createdAt"> | 23 | <a [routerLink]="['/w', video.shortUUID, { 'threadId': comment.threadId }]" class="comment-date" [title]="comment.createdAt"> |
24 | {{ comment.createdAt | myFromNow }} | 24 | {{ comment.createdAt | myFromNow }} |
25 | </a> | 25 | </a> |
26 | </div> | 26 | </div> |
@@ -45,7 +45,7 @@ | |||
45 | <ng-container *ngIf="comment.isDeleted"> | 45 | <ng-container *ngIf="comment.isDeleted"> |
46 | <div class="comment-account-date"> | 46 | <div class="comment-account-date"> |
47 | <span class="comment-account" i18n>Deleted</span> | 47 | <span class="comment-account" i18n>Deleted</span> |
48 | <a [routerLink]="['/w', video.uuid, { 'threadId': comment.threadId }]" | 48 | <a [routerLink]="['/w', video.shortUUID, { 'threadId': comment.threadId }]" |
49 | class="comment-date">{{ comment.createdAt | myFromNow }}</a> | 49 | class="comment-date">{{ comment.createdAt | myFromNow }}</a> |
50 | </div> | 50 | </div> |
51 | 51 | ||
diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts index 210236b61..2c39e63fb 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts | |||
@@ -247,7 +247,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
247 | this.componentPagination.totalItems = null | 247 | this.componentPagination.totalItems = null |
248 | this.totalNotDeletedComments = null | 248 | this.totalNotDeletedComments = null |
249 | 249 | ||
250 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) | 250 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video) |
251 | this.loadMoreThreads() | 251 | this.loadMoreThreads() |
252 | } | 252 | } |
253 | } | 253 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index a444dc51f..12b0baebe 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -312,7 +312,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
312 | 312 | ||
313 | getVideoUrl () { | 313 | getVideoUrl () { |
314 | if (!this.video.url) { | 314 | if (!this.video.url) { |
315 | return this.video.originInstanceUrl + VideoDetails.buildClientUrl(this.video.uuid) | 315 | return this.video.originInstanceUrl + VideoDetails.buildWatchUrl(this.video) |
316 | } | 316 | } |
317 | return this.video.url | 317 | return this.video.url |
318 | } | 318 | } |
@@ -415,7 +415,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
415 | 415 | ||
416 | private loadVideo (videoId: string) { | 416 | private loadVideo (videoId: string) { |
417 | // Video did not change | 417 | // Video did not change |
418 | if (this.video && this.video.uuid === videoId) return | 418 | if ( |
419 | this.video && | ||
420 | (this.video.uuid === videoId || this.video.shortUUID === videoId) | ||
421 | ) return | ||
419 | 422 | ||
420 | if (this.player) this.player.pause() | 423 | if (this.player) this.player.pause() |
421 | 424 | ||
@@ -489,7 +492,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
489 | 492 | ||
490 | private loadPlaylist (playlistId: string) { | 493 | private loadPlaylist (playlistId: string) { |
491 | // Playlist did not change | 494 | // Playlist did not change |
492 | if (this.playlist && this.playlist.uuid === playlistId) return | 495 | if ( |
496 | this.playlist && | ||
497 | (this.playlist.uuid === playlistId || this.playlist.shortUUID === playlistId) | ||
498 | ) return | ||
493 | 499 | ||
494 | this.playlistService.getVideoPlaylist(playlistId) | 500 | this.playlistService.getVideoPlaylist(playlistId) |
495 | .pipe( | 501 | .pipe( |
@@ -772,13 +778,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
772 | 778 | ||
773 | private flushPlayer () { | 779 | private flushPlayer () { |
774 | // Remove player if it exists | 780 | // Remove player if it exists |
775 | if (this.player) { | 781 | if (!this.player) return |
776 | try { | 782 | |
777 | this.player.dispose() | 783 | try { |
778 | this.player = undefined | 784 | this.player.dispose() |
779 | } catch (err) { | 785 | this.player = undefined |
780 | console.error('Cannot dispose player.', err) | 786 | } catch (err) { |
781 | } | 787 | console.error('Cannot dispose player.', err) |
782 | } | 788 | } |
783 | } | 789 | } |
784 | 790 | ||
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 07b9dddba..67aa0e399 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -116,11 +116,11 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
116 | } | 116 | } |
117 | 117 | ||
118 | getVideoUrl (abuse: AdminAbuse) { | 118 | getVideoUrl (abuse: AdminAbuse) { |
119 | return Video.buildClientUrl(abuse.video.uuid) | 119 | return Video.buildWatchUrl(abuse.video) |
120 | } | 120 | } |
121 | 121 | ||
122 | getCommentUrl (abuse: AdminAbuse) { | 122 | getCommentUrl (abuse: AdminAbuse) { |
123 | return Video.buildClientUrl(abuse.comment.video.uuid) + ';threadId=' + abuse.comment.threadId | 123 | return Video.buildWatchUrl(abuse.comment.video) + ';threadId=' + abuse.comment.threadId |
124 | } | 124 | } |
125 | 125 | ||
126 | getAccountUrl (abuse: ProcessedAbuse) { | 126 | getAccountUrl (abuse: ProcessedAbuse) { |
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 | }) |
8 | export class LinkComponent { | 8 | export 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' |
15 | import { Video } from '../video' | ||
15 | 16 | ||
16 | export class UserNotification implements UserNotificationServer { | 17 | export 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 |
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.ts index 2a73e6166..a41ff248b 100644 --- a/client/src/app/shared/shared-share-modal/video-share.component.ts +++ b/client/src/app/shared/shared-share-modal/video-share.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' |
2 | import { VideoDetails } from '@app/shared/shared-main' | 2 | import { Video, VideoDetails } from '@app/shared/shared-main' |
3 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' | 3 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { VideoCaption } from '@shared/models' | 5 | import { VideoCaption } from '@shared/models' |
@@ -98,14 +98,15 @@ export class VideoShareComponent { | |||
98 | 98 | ||
99 | getVideoUrl () { | 99 | getVideoUrl () { |
100 | let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin | 100 | let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin |
101 | baseUrl += '/w/' + this.video.uuid | 101 | baseUrl += Video.buildWatchUrl(this.video) |
102 | |||
102 | const options = this.getVideoOptions(baseUrl) | 103 | const options = this.getVideoOptions(baseUrl) |
103 | 104 | ||
104 | return buildVideoLink(options) | 105 | return buildVideoLink(options) |
105 | } | 106 | } |
106 | 107 | ||
107 | getPlaylistUrl () { | 108 | getPlaylistUrl () { |
108 | const base = window.location.origin + '/w/p/' + this.playlist.uuid | 109 | const base = window.location.origin + VideoPlaylist.buildWatchUrl(this.playlist) |
109 | 110 | ||
110 | if (!this.includeVideoInPlaylist) return base | 111 | if (!this.includeVideoInPlaylist) return base |
111 | 112 | ||
diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts index d5583c29f..ad5d30db2 100644 --- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts +++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts | |||
@@ -12,7 +12,7 @@ export class VideoThumbnailComponent { | |||
12 | @Input() video: Video | 12 | @Input() video: Video |
13 | @Input() nsfw = false | 13 | @Input() nsfw = false |
14 | 14 | ||
15 | @Input() videoRouterLink: any[] | 15 | @Input() videoRouterLink: string | any[] |
16 | @Input() queryParams: { [ p: string ]: any } | 16 | @Input() queryParams: { [ p: string ]: any } |
17 | @Input() videoHref: string | 17 | @Input() videoHref: string |
18 | @Input() videoTarget: string | 18 | @Input() videoTarget: string |
@@ -57,7 +57,7 @@ export class VideoThumbnailComponent { | |||
57 | getVideoRouterLink () { | 57 | getVideoRouterLink () { |
58 | if (this.videoRouterLink) return this.videoRouterLink | 58 | if (this.videoRouterLink) return this.videoRouterLink |
59 | 59 | ||
60 | return [ '/w', this.video.uuid ] | 60 | return Video.buildWatchUrl(this.video) |
61 | } | 61 | } |
62 | 62 | ||
63 | onWatchLaterClick (event: Event) { | 63 | onWatchLaterClick (event: Event) { |
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts index 94d6c5fa8..ba0f57e8f 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.model.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { getAbsoluteAPIUrl } from '@app/helpers' | 1 | import { getAbsoluteAPIUrl } from '@app/helpers' |
2 | import { Account, Actor } from '@app/shared/shared-main' | 2 | import { Account, Actor, Video } from '@app/shared/shared-main' |
3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel } from '@shared/models' | 3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel } from '@shared/models' |
4 | 4 | ||
5 | export class VideoComment implements VideoCommentServerModel { | 5 | export class VideoComment implements VideoCommentServerModel { |
@@ -85,7 +85,7 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel { | |||
85 | id: hash.video.id, | 85 | id: hash.video.id, |
86 | uuid: hash.video.uuid, | 86 | uuid: hash.video.uuid, |
87 | name: hash.video.name, | 87 | name: hash.video.name, |
88 | localUrl: '/w/' + hash.video.uuid | 88 | localUrl: Video.buildWatchUrl(hash.video) |
89 | } | 89 | } |
90 | 90 | ||
91 | this.localUrl = this.video.localUrl + ';threadId=' + this.threadId | 91 | this.localUrl = this.video.localUrl + ';threadId=' + this.threadId |
diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts index c5aeb3c12..4f1452116 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.service.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts | |||
@@ -9,6 +9,7 @@ import { | |||
9 | FeedFormat, | 9 | FeedFormat, |
10 | ResultList, | 10 | ResultList, |
11 | ThreadsResultList, | 11 | ThreadsResultList, |
12 | Video, | ||
12 | VideoComment as VideoCommentServerModel, | 13 | VideoComment as VideoCommentServerModel, |
13 | VideoCommentAdmin, | 14 | VideoCommentAdmin, |
14 | VideoCommentCreate, | 15 | VideoCommentCreate, |
@@ -127,7 +128,7 @@ export class VideoCommentService { | |||
127 | ) | 128 | ) |
128 | } | 129 | } |
129 | 130 | ||
130 | getVideoCommentsFeeds (videoUUID?: string) { | 131 | getVideoCommentsFeeds (video: Pick<Video, 'uuid'>) { |
131 | const feeds = [ | 132 | const feeds = [ |
132 | { | 133 | { |
133 | format: FeedFormat.RSS, | 134 | format: FeedFormat.RSS, |
@@ -146,9 +147,9 @@ export class VideoCommentService { | |||
146 | } | 147 | } |
147 | ] | 148 | ] |
148 | 149 | ||
149 | if (videoUUID !== undefined) { | 150 | if (video !== undefined) { |
150 | for (const feed of feeds) { | 151 | for (const feed of feeds) { |
151 | feed.url += '?videoId=' + videoUUID | 152 | feed.url += '?videoId=' + video.uuid |
152 | } | 153 | } |
153 | } | 154 | } |
154 | 155 | ||
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index fe161c977..67e0de6a2 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -85,7 +85,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
85 | playlistElementId?: number | 85 | playlistElementId?: number |
86 | } | 86 | } |
87 | 87 | ||
88 | videoRouterLink: any[] = [] | 88 | videoRouterLink: string | any[] = [] |
89 | videoHref: string | 89 | videoHref: string |
90 | videoTarget: string | 90 | videoTarget: string |
91 | 91 | ||
@@ -120,7 +120,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
120 | 120 | ||
121 | buildVideoLink () { | 121 | buildVideoLink () { |
122 | if (this.videoLinkType === 'internal' || !this.video.url) { | 122 | if (this.videoLinkType === 'internal' || !this.video.url) { |
123 | this.videoRouterLink = [ '/w', this.video.uuid ] | 123 | this.videoRouterLink = Video.buildWatchUrl(this.video) |
124 | return | 124 | return |
125 | } | 125 | } |
126 | 126 | ||
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts index 57eab4dfd..d99170e4e 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts | |||
@@ -66,7 +66,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
66 | buildRouterLink () { | 66 | buildRouterLink () { |
67 | if (!this.playlist) return null | 67 | if (!this.playlist) return null |
68 | 68 | ||
69 | return [ '/w/p', this.playlist.uuid ] | 69 | return VideoPlaylist.buildWatchUrl(this.playlist) |
70 | } | 70 | } |
71 | 71 | ||
72 | buildRouterQuery () { | 72 | buildRouterQuery () { |
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts index 8de5092a9..c80ea2e6b 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts | |||
@@ -39,7 +39,7 @@ export class VideoPlaylistMiniatureComponent implements OnInit { | |||
39 | } | 39 | } |
40 | 40 | ||
41 | if (this.linkType === 'internal' || !this.playlist.url) { | 41 | if (this.linkType === 'internal' || !this.playlist.url) { |
42 | this.routerLink = [ '/w/p', this.playlist.uuid ] | 42 | this.routerLink = VideoPlaylist.buildWatchUrl(this.playlist) |
43 | return | 43 | return |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts index d67f372f4..d96b70922 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts | |||
@@ -13,6 +13,8 @@ import { | |||
13 | export class VideoPlaylist implements ServerVideoPlaylist { | 13 | export class VideoPlaylist implements ServerVideoPlaylist { |
14 | id: number | 14 | id: number |
15 | uuid: string | 15 | uuid: string |
16 | shortUUID: string | ||
17 | |||
16 | isLocal: boolean | 18 | isLocal: boolean |
17 | 19 | ||
18 | url: string | 20 | url: string |
@@ -41,11 +43,17 @@ export class VideoPlaylist implements ServerVideoPlaylist { | |||
41 | 43 | ||
42 | videoChannelBy?: string | 44 | videoChannelBy?: string |
43 | 45 | ||
46 | static buildWatchUrl (playlist: Pick<VideoPlaylist, 'uuid' | 'shortUUID'>) { | ||
47 | return '/w/p/' + (playlist.uuid || playlist.shortUUID) | ||
48 | } | ||
49 | |||
44 | constructor (hash: ServerVideoPlaylist, translations: {}) { | 50 | constructor (hash: ServerVideoPlaylist, translations: {}) { |
45 | const absoluteAPIUrl = getAbsoluteAPIUrl() | 51 | const absoluteAPIUrl = getAbsoluteAPIUrl() |
46 | 52 | ||
47 | this.id = hash.id | 53 | this.id = hash.id |
48 | this.uuid = hash.uuid | 54 | this.uuid = hash.uuid |
55 | this.shortUUID = hash.shortUUID | ||
56 | |||
49 | this.url = hash.url | 57 | this.url = hash.url |
50 | this.isLocal = hash.isLocal | 58 | this.isLocal = hash.isLocal |
51 | 59 | ||