diff options
Diffstat (limited to 'client/src/app/+videos/+video-watch')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 24 |
1 files changed, 21 insertions, 3 deletions
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 b15de2a79..33de901c0 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -39,6 +39,7 @@ import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' | |||
39 | import { environment } from '../../../environments/environment' | 39 | import { environment } from '../../../environments/environment' |
40 | import { VideoSupportComponent } from './modal/video-support.component' | 40 | import { VideoSupportComponent } from './modal/video-support.component' |
41 | import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' | 41 | import { VideoWatchPlaylistComponent } from './video-watch-playlist.component' |
42 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
42 | 43 | ||
43 | type URLOptions = CustomizationOptions & { playerMode: PlayerMode } | 44 | type URLOptions = CustomizationOptions & { playerMode: PlayerMode } |
44 | 45 | ||
@@ -412,13 +413,25 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
412 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, | 413 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, |
413 | $localize`Redirection` | 414 | $localize`Redirection` |
414 | ).then(res => { | 415 | ).then(res => { |
415 | if (res === false) return this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]) | 416 | if (res === false) { |
417 | return this.restExtractor.redirectTo404IfNotFound(err, [ | ||
418 | HttpStatusCode.BAD_REQUEST_400, | ||
419 | HttpStatusCode.UNAUTHORIZED_401, | ||
420 | HttpStatusCode.FORBIDDEN_403, | ||
421 | HttpStatusCode.NOT_FOUND_404 | ||
422 | ]) | ||
423 | } | ||
416 | 424 | ||
417 | return window.location.href = originUrl | 425 | return window.location.href = originUrl |
418 | }) | 426 | }) |
419 | } | 427 | } |
420 | 428 | ||
421 | return this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]) | 429 | return this.restExtractor.redirectTo404IfNotFound(err, [ |
430 | HttpStatusCode.BAD_REQUEST_400, | ||
431 | HttpStatusCode.UNAUTHORIZED_401, | ||
432 | HttpStatusCode.FORBIDDEN_403, | ||
433 | HttpStatusCode.NOT_FOUND_404 | ||
434 | ]) | ||
422 | }) | 435 | }) |
423 | ) | 436 | ) |
424 | .subscribe(([ video, captionsResult ]) => { | 437 | .subscribe(([ video, captionsResult ]) => { |
@@ -450,7 +463,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
450 | this.playlistService.getVideoPlaylist(playlistId) | 463 | this.playlistService.getVideoPlaylist(playlistId) |
451 | .pipe( | 464 | .pipe( |
452 | // If 401, the video is private or blocked so redirect to 404 | 465 | // If 401, the video is private or blocked so redirect to 404 |
453 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])) | 466 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ |
467 | HttpStatusCode.BAD_REQUEST_400, | ||
468 | HttpStatusCode.UNAUTHORIZED_401, | ||
469 | HttpStatusCode.FORBIDDEN_403, | ||
470 | HttpStatusCode.NOT_FOUND_404 | ||
471 | ])) | ||
454 | ) | 472 | ) |
455 | .subscribe(playlist => { | 473 | .subscribe(playlist => { |
456 | this.playlist = playlist | 474 | this.playlist = playlist |