diff options
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | 22 | ||||
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 24 |
2 files changed, 35 insertions, 11 deletions
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 bee3679f7..cafb030b9 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 | |||
@@ -9,6 +9,7 @@ import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/sh | |||
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { VideoPrivacy } from '@shared/models' | 10 | import { VideoPrivacy } from '@shared/models' |
11 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
12 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-video-upload', | 15 | selector: 'my-video-upload', |
@@ -129,17 +130,17 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
129 | cancelUpload () { | 130 | cancelUpload () { |
130 | if (this.videoUploadObservable !== null) { | 131 | if (this.videoUploadObservable !== null) { |
131 | this.videoUploadObservable.unsubscribe() | 132 | this.videoUploadObservable.unsubscribe() |
133 | } | ||
132 | 134 | ||
133 | this.isUploadingVideo = false | 135 | this.isUploadingVideo = false |
134 | this.videoUploadPercents = 0 | 136 | this.videoUploadPercents = 0 |
135 | this.videoUploadObservable = null | 137 | this.videoUploadObservable = null |
136 | 138 | ||
137 | this.firstStepError.emit() | 139 | this.firstStepError.emit() |
138 | this.enableRetryAfterError = false | 140 | this.enableRetryAfterError = false |
139 | this.error = '' | 141 | this.error = '' |
140 | 142 | ||
141 | this.notifier.info($localize`Upload cancelled`) | 143 | this.notifier.info($localize`Upload cancelled`) |
142 | } | ||
143 | } | 144 | } |
144 | 145 | ||
145 | uploadFirstStep (clickedOnButton = false) { | 146 | uploadFirstStep (clickedOnButton = false) { |
@@ -229,6 +230,11 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
229 | notifier: this.notifier, | 230 | notifier: this.notifier, |
230 | sticky: false | 231 | sticky: false |
231 | }) | 232 | }) |
233 | |||
234 | if (err.status === HttpStatusCode.PAYLOAD_TOO_LARGE_413 || | ||
235 | err.status === HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415) { | ||
236 | this.cancelUpload() | ||
237 | } | ||
232 | } | 238 | } |
233 | ) | 239 | ) |
234 | } | 240 | } |
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 |