aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
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/+videos
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/+videos')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts6
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts12
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.ts8
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.html4
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comments.component.ts2
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts26
7 files changed, 35 insertions, 25 deletions
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
2import { forkJoin } from 'rxjs' 2import { forkJoin } from 'rxjs'
3import { AfterViewChecked, AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' 3import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
4import { Router } from '@angular/router' 4import { Router } from '@angular/router'
5import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' 5import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
6import { scrollToTop } from '@app/helpers' 6import { scrollToTop } from '@app/helpers'
7import { FormValidatorService } from '@app/shared/shared-forms' 7import { FormValidatorService } from '@app/shared/shared-forms'
8import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 8import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
9import { LiveVideoService } from '@app/shared/shared-video-live' 9import { LiveVideoService } from '@app/shared/shared-video-live'
10import { LoadingBarService } from '@ngx-loading-bar/core' 10import { LoadingBarService } from '@ngx-loading-bar/core'
11import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models' 11import { 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 @@
1import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx'
2import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http'
1import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' 3import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
2import { Router } from '@angular/router' 4import { Router } from '@angular/router'
3import { UploadxOptions, UploadState, UploadxService } from 'ngx-uploadx'
4import { UploaderXFormData } from './uploaderx-form-data'
5import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core' 5import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core'
6import { scrollToTop, genericUploadErrorHandler } from '@app/helpers' 6import { genericUploadErrorHandler, scrollToTop } from '@app/helpers'
7import { FormValidatorService } from '@app/shared/shared-forms' 7import { FormValidatorService } from '@app/shared/shared-forms'
8import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 8import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
9import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 10import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
11import { VideoPrivacy } from '@shared/models' 11import { VideoPrivacy } from '@shared/models'
12import { UploaderXFormData } from './uploaderx-form-data'
12import { VideoSend } from './video-send' 13import { VideoSend } from './video-send'
13import { 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'
5import { ActivatedRoute, Router } from '@angular/router' 5import { ActivatedRoute, Router } from '@angular/router'
6import { Notifier } from '@app/core' 6import { Notifier } from '@app/core'
7import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 7import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
8import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' 8import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
9import { LiveVideoService } from '@app/shared/shared-video-live' 9import { LiveVideoService } from '@app/shared/shared-video-live'
10import { LoadingBarService } from '@ngx-loading-bar/core' 10import { LoadingBarService } from '@ngx-loading-bar/core'
11import { LiveVideo, LiveVideoUpdate, VideoPrivacy } from '@shared/models' 11import { 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