diff options
Diffstat (limited to 'client/src')
20 files changed, 114 insertions, 33 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 78be2e5dd..78e8e9682 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts | |||
@@ -124,6 +124,10 @@ function sortBy (obj: any[], key1: string, key2?: string) { | |||
124 | }) | 124 | }) |
125 | } | 125 | } |
126 | 126 | ||
127 | function scrollToTop () { | ||
128 | window.scroll(0, 0) | ||
129 | } | ||
130 | |||
127 | export { | 131 | export { |
128 | sortBy, | 132 | sortBy, |
129 | durationToString, | 133 | durationToString, |
@@ -135,5 +139,6 @@ export { | |||
135 | immutableAssign, | 139 | immutableAssign, |
136 | objectToFormData, | 140 | objectToFormData, |
137 | lineFeedToHtml, | 141 | lineFeedToHtml, |
138 | removeElementFromArray | 142 | removeElementFromArray, |
143 | scrollToTop | ||
139 | } | 144 | } |
diff --git a/client/src/app/signup/signup.component.html b/client/src/app/signup/signup.component.html index 531a97814..0207a166e 100644 --- a/client/src/app/signup/signup.component.html +++ b/client/src/app/signup/signup.component.html | |||
@@ -4,6 +4,7 @@ | |||
4 | Create an account | 4 | Create an account |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <div *ngIf="info" class="alert alert-info">{{ info }}</div> | ||
7 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | 8 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> |
8 | 9 | ||
9 | <div class="d-flex justify-content-left flex-wrap"> | 10 | <div class="d-flex justify-content-left flex-wrap"> |
@@ -59,7 +60,7 @@ | |||
59 | </div> | 60 | </div> |
60 | </div> | 61 | </div> |
61 | 62 | ||
62 | <input type="submit" i18n-value value="Signup" [disabled]="!form.valid"> | 63 | <input type="submit" i18n-value value="Signup" [disabled]="!form.valid || signupDone"> |
63 | </form> | 64 | </form> |
64 | 65 | ||
65 | <div> | 66 | <div> |
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts index cf2657b85..3341d4e09 100644 --- a/client/src/app/signup/signup.component.ts +++ b/client/src/app/signup/signup.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core' | |||
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { UserCreate } from '../../../../shared' | 3 | import { UserCreate } from '../../../../shared' |
4 | import { FormReactive, UserService, UserValidatorsService } from '../shared' | 4 | import { FormReactive, UserService, UserValidatorsService } from '../shared' |
5 | import { RedirectService, ServerService } from '@app/core' | 5 | import { AuthService, RedirectService, ServerService } from '@app/core' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
8 | 8 | ||
@@ -12,10 +12,13 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val | |||
12 | styleUrls: [ './signup.component.scss' ] | 12 | styleUrls: [ './signup.component.scss' ] |
13 | }) | 13 | }) |
14 | export class SignupComponent extends FormReactive implements OnInit { | 14 | export class SignupComponent extends FormReactive implements OnInit { |
15 | info: string = null | ||
15 | error: string = null | 16 | error: string = null |
17 | signupDone = false | ||
16 | 18 | ||
17 | constructor ( | 19 | constructor ( |
18 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | ||
19 | private userValidatorsService: UserValidatorsService, | 22 | private userValidatorsService: UserValidatorsService, |
20 | private notificationsService: NotificationsService, | 23 | private notificationsService: NotificationsService, |
21 | private userService: UserService, | 24 | private userService: UserService, |
@@ -50,18 +53,27 @@ export class SignupComponent extends FormReactive implements OnInit { | |||
50 | 53 | ||
51 | this.userService.signup(userCreate).subscribe( | 54 | this.userService.signup(userCreate).subscribe( |
52 | () => { | 55 | () => { |
56 | this.signupDone = true | ||
57 | |||
53 | if (this.requiresEmailVerification) { | 58 | if (this.requiresEmailVerification) { |
54 | this.notificationsService.alert( | 59 | this.info = this.i18n('Welcome! Now please check your emails to verify your account and complete signup.') |
55 | this.i18n('Welcome'), | 60 | return |
56 | this.i18n('Please check your email to verify your account and complete signup.') | ||
57 | ) | ||
58 | } else { | ||
59 | this.notificationsService.success( | ||
60 | this.i18n('Success'), | ||
61 | this.i18n('Registration for {{username}} complete.', { username: userCreate.username }) | ||
62 | ) | ||
63 | } | 61 | } |
64 | this.redirectService.redirectToHomepage() | 62 | |
63 | // Auto login | ||
64 | this.authService.login(userCreate.username, userCreate.password) | ||
65 | .subscribe( | ||
66 | () => { | ||
67 | this.notificationsService.success( | ||
68 | this.i18n('Success'), | ||
69 | this.i18n('You are now logged in as {{username}}!', { username: userCreate.username }) | ||
70 | ) | ||
71 | |||
72 | this.redirectService.redirectToHomepage() | ||
73 | }, | ||
74 | |||
75 | err => this.error = err.message | ||
76 | ) | ||
65 | }, | 77 | }, |
66 | 78 | ||
67 | err => this.error = err.message | 79 | err => this.error = err.message |
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts index 796fbe531..eaf819726 100644 --- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts | |||
@@ -60,6 +60,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
60 | hide () { | 60 | hide () { |
61 | this.closingModal = true | 61 | this.closingModal = true |
62 | this.openedModal.close() | 62 | this.openedModal.close() |
63 | this.form.reset() | ||
63 | } | 64 | } |
64 | 65 | ||
65 | isReplacingExistingCaption () { | 66 | isReplacingExistingCaption () { |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html index a933a64f0..11a81ad66 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html | |||
@@ -45,7 +45,12 @@ | |||
45 | </div> | 45 | </div> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | <div *ngIf="hasImportedVideo" class="alert alert-info" i18n> | 48 | <div *ngIf="error" class="alert alert-danger"> |
49 | <div i18n>Sorry, but something went wrong</div> | ||
50 | {{ error }} | ||
51 | </div> | ||
52 | |||
53 | <div *ngIf="hasImportedVideo && !error" class="alert alert-info" i18n> | ||
49 | Congratulations, the video will be imported with BitTorrent! You can already add information about this video. | 54 | Congratulations, the video will be imported with BitTorrent! You can already add information about this video. |
50 | </div> | 55 | </div> |
51 | 56 | ||
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss index 262b0b68e..00626cd7b 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss | |||
@@ -7,6 +7,14 @@ $width-size: 190px; | |||
7 | @include peertube-select-container($width-size); | 7 | @include peertube-select-container($width-size); |
8 | } | 8 | } |
9 | 9 | ||
10 | .alert.alert-danger { | ||
11 | text-align: center; | ||
12 | |||
13 | & > div { | ||
14 | font-weight: $font-semibold; | ||
15 | } | ||
16 | } | ||
17 | |||
10 | .import-video-torrent { | 18 | .import-video-torrent { |
11 | display: flex; | 19 | display: flex; |
12 | flex-direction: column; | 20 | flex-direction: column; |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index e13c06ce9..13776ae36 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -12,6 +12,7 @@ import { VideoEdit } from '@app/shared/video/video-edit.model' | |||
12 | import { FormValidatorService } from '@app/shared' | 12 | import { FormValidatorService } from '@app/shared' |
13 | import { VideoCaptionService } from '@app/shared/video-caption' | 13 | import { VideoCaptionService } from '@app/shared/video-caption' |
14 | import { VideoImportService } from '@app/shared/video-import' | 14 | import { VideoImportService } from '@app/shared/video-import' |
15 | import { scrollToTop } from '@app/shared/misc/utils' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-import-torrent', | 18 | selector: 'my-video-import-torrent', |
@@ -23,9 +24,9 @@ import { VideoImportService } from '@app/shared/video-import' | |||
23 | }) | 24 | }) |
24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { | 25 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { |
25 | @Output() firstStepDone = new EventEmitter<string>() | 26 | @Output() firstStepDone = new EventEmitter<string>() |
27 | @Output() firstStepError = new EventEmitter<void>() | ||
26 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> | 28 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> |
27 | 29 | ||
28 | videoFileName: string | ||
29 | magnetUri = '' | 30 | magnetUri = '' |
30 | 31 | ||
31 | isImportingVideo = false | 32 | isImportingVideo = false |
@@ -33,6 +34,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
33 | isUpdatingVideo = false | 34 | isUpdatingVideo = false |
34 | 35 | ||
35 | video: VideoEdit | 36 | video: VideoEdit |
37 | error: string | ||
36 | 38 | ||
37 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | 39 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC |
38 | 40 | ||
@@ -104,6 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
104 | err => { | 106 | err => { |
105 | this.loadingBar.complete() | 107 | this.loadingBar.complete() |
106 | this.isImportingVideo = false | 108 | this.isImportingVideo = false |
109 | this.firstStepError.emit() | ||
107 | this.notificationsService.error(this.i18n('Error'), err.message) | 110 | this.notificationsService.error(this.i18n('Error'), err.message) |
108 | } | 111 | } |
109 | ) | 112 | ) |
@@ -129,8 +132,8 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
129 | }, | 132 | }, |
130 | 133 | ||
131 | err => { | 134 | err => { |
132 | this.isUpdatingVideo = false | 135 | this.error = err.message |
133 | this.notificationsService.error(this.i18n('Error'), err.message) | 136 | scrollToTop() |
134 | console.error(err) | 137 | console.error(err) |
135 | } | 138 | } |
136 | ) | 139 | ) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html index 9f5fc6d22..533446672 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html | |||
@@ -37,7 +37,13 @@ | |||
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
39 | 39 | ||
40 | <div *ngIf="hasImportedVideo" class="alert alert-info" i18n> | 40 | |
41 | <div *ngIf="error" class="alert alert-danger"> | ||
42 | <div i18n>Sorry, but something went wrong</div> | ||
43 | {{ error }} | ||
44 | </div> | ||
45 | |||
46 | <div *ngIf="!error && hasImportedVideo" class="alert alert-info" i18n> | ||
41 | Congratulations, the video behind {{ targetUrl }} will be imported! You can already add information about this video. | 47 | Congratulations, the video behind {{ targetUrl }} will be imported! You can already add information about this video. |
42 | </div> | 48 | </div> |
43 | 49 | ||
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss index 7c6deda1d..e907edc70 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss | |||
@@ -7,6 +7,14 @@ $width-size: 190px; | |||
7 | @include peertube-select-container($width-size); | 7 | @include peertube-select-container($width-size); |
8 | } | 8 | } |
9 | 9 | ||
10 | .alert.alert-danger { | ||
11 | text-align: center; | ||
12 | |||
13 | & > div { | ||
14 | font-weight: $font-semibold; | ||
15 | } | ||
16 | } | ||
17 | |||
10 | .import-video-url { | 18 | .import-video-url { |
11 | display: flex; | 19 | display: flex; |
12 | flex-direction: column; | 20 | flex-direction: column; |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 031e557ed..9cdface75 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -12,6 +12,7 @@ import { VideoEdit } from '@app/shared/video/video-edit.model' | |||
12 | import { FormValidatorService } from '@app/shared' | 12 | import { FormValidatorService } from '@app/shared' |
13 | import { VideoCaptionService } from '@app/shared/video-caption' | 13 | import { VideoCaptionService } from '@app/shared/video-caption' |
14 | import { VideoImportService } from '@app/shared/video-import' | 14 | import { VideoImportService } from '@app/shared/video-import' |
15 | import { scrollToTop } from '@app/shared/misc/utils' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-import-url', | 18 | selector: 'my-video-import-url', |
@@ -23,15 +24,16 @@ import { VideoImportService } from '@app/shared/video-import' | |||
23 | }) | 24 | }) |
24 | export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate { | 25 | export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate { |
25 | @Output() firstStepDone = new EventEmitter<string>() | 26 | @Output() firstStepDone = new EventEmitter<string>() |
27 | @Output() firstStepError = new EventEmitter<void>() | ||
26 | 28 | ||
27 | targetUrl = '' | 29 | targetUrl = '' |
28 | videoFileName: string | ||
29 | 30 | ||
30 | isImportingVideo = false | 31 | isImportingVideo = false |
31 | hasImportedVideo = false | 32 | hasImportedVideo = false |
32 | isUpdatingVideo = false | 33 | isUpdatingVideo = false |
33 | 34 | ||
34 | video: VideoEdit | 35 | video: VideoEdit |
36 | error: string | ||
35 | 37 | ||
36 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | 38 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC |
37 | 39 | ||
@@ -96,6 +98,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
96 | err => { | 98 | err => { |
97 | this.loadingBar.complete() | 99 | this.loadingBar.complete() |
98 | this.isImportingVideo = false | 100 | this.isImportingVideo = false |
101 | this.firstStepError.emit() | ||
99 | this.notificationsService.error(this.i18n('Error'), err.message) | 102 | this.notificationsService.error(this.i18n('Error'), err.message) |
100 | } | 103 | } |
101 | ) | 104 | ) |
@@ -121,8 +124,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
121 | }, | 124 | }, |
122 | 125 | ||
123 | err => { | 126 | err => { |
124 | this.isUpdatingVideo = false | 127 | this.error = err.message |
125 | this.notificationsService.error(this.i18n('Error'), err.message) | 128 | scrollToTop() |
126 | console.error(err) | 129 | console.error(err) |
127 | } | 130 | } |
128 | ) | 131 | ) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 1bf22e1a9..71d2544d8 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -21,6 +21,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
21 | firstStepChannelId = 0 | 21 | firstStepChannelId = 0 |
22 | 22 | ||
23 | abstract firstStepDone: EventEmitter<string> | 23 | abstract firstStepDone: EventEmitter<string> |
24 | abstract firstStepError: EventEmitter<void> | ||
24 | protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy | 25 | protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy |
25 | 26 | ||
26 | protected loadingBar: LoadingBarService | 27 | protected loadingBar: LoadingBarService |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index fa57c8cb5..a09f54dfc 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html | |||
@@ -29,7 +29,7 @@ | |||
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | 31 | ||
32 | <div *ngIf="isUploadingVideo" class="upload-progress-cancel"> | 32 | <div *ngIf="isUploadingVideo && !error" class="upload-progress-cancel"> |
33 | <p-progressBar | 33 | <p-progressBar |
34 | [value]="videoUploadPercents" | 34 | [value]="videoUploadPercents" |
35 | [ngClass]="{ processing: videoUploadPercents === 100 && videoUploaded === false }" | 35 | [ngClass]="{ processing: videoUploadPercents === 100 && videoUploaded === false }" |
@@ -37,6 +37,11 @@ | |||
37 | <input *ngIf="videoUploaded === false" type="button" value="Cancel" (click)="cancelUpload()" /> | 37 | <input *ngIf="videoUploaded === false" type="button" value="Cancel" (click)="cancelUpload()" /> |
38 | </div> | 38 | </div> |
39 | 39 | ||
40 | <div *ngIf="error" class="alert alert-danger"> | ||
41 | <div i18n>Sorry, but something went wrong</div> | ||
42 | {{ error }} | ||
43 | </div> | ||
44 | |||
40 | <!-- Hidden because we want to load the component --> | 45 | <!-- Hidden because we want to load the component --> |
41 | <form [hidden]="!isUploadingVideo" novalidate [formGroup]="form"> | 46 | <form [hidden]="!isUploadingVideo" novalidate [formGroup]="form"> |
42 | <my-video-edit | 47 | <my-video-edit |
@@ -55,4 +60,4 @@ | |||
55 | <input [disabled]="isPublishingButtonDisabled()" type="button" i18n-value value="Publish" /> | 60 | <input [disabled]="isPublishingButtonDisabled()" type="button" i18n-value value="Publish" /> |
56 | </div> | 61 | </div> |
57 | </div> | 62 | </div> |
58 | </form> \ No newline at end of file | 63 | </form> |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss index dbae5230d..cf1725ef9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss | |||
@@ -5,6 +5,14 @@ | |||
5 | @include peertube-select-container(190px); | 5 | @include peertube-select-container(190px); |
6 | } | 6 | } |
7 | 7 | ||
8 | .alert.alert-danger { | ||
9 | text-align: center; | ||
10 | |||
11 | & > div { | ||
12 | font-weight: $font-semibold; | ||
13 | } | ||
14 | } | ||
15 | |||
8 | .upload-video { | 16 | .upload-video { |
9 | display: flex; | 17 | display: flex; |
10 | flex-direction: column; | 18 | flex-direction: column; |
@@ -82,4 +90,4 @@ | |||
82 | 90 | ||
83 | margin-left: 10px; | 91 | margin-left: 10px; |
84 | } | 92 | } |
85 | } \ No newline at end of file | 93 | } |
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 8e2d0deaf..3fcb71ac3 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 | |||
@@ -14,6 +14,7 @@ import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-se | |||
14 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 14 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' |
15 | import { FormValidatorService, UserService } from '@app/shared' | 15 | import { FormValidatorService, UserService } from '@app/shared' |
16 | import { VideoCaptionService } from '@app/shared/video-caption' | 16 | import { VideoCaptionService } from '@app/shared/video-caption' |
17 | import { scrollToTop } from '@app/shared/misc/utils' | ||
17 | 18 | ||
18 | @Component({ | 19 | @Component({ |
19 | selector: 'my-video-upload', | 20 | selector: 'my-video-upload', |
@@ -25,6 +26,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' | |||
25 | }) | 26 | }) |
26 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { | 27 | export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { |
27 | @Output() firstStepDone = new EventEmitter<string>() | 28 | @Output() firstStepDone = new EventEmitter<string>() |
29 | @Output() firstStepError = new EventEmitter<void>() | ||
28 | @ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement> | 30 | @ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement> |
29 | 31 | ||
30 | // So that it can be accessed in the template | 32 | // So that it can be accessed in the template |
@@ -43,6 +45,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
43 | uuid: '' | 45 | uuid: '' |
44 | } | 46 | } |
45 | 47 | ||
48 | error: string | ||
49 | |||
46 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | 50 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC |
47 | 51 | ||
48 | constructor ( | 52 | constructor ( |
@@ -201,6 +205,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
201 | this.isUploadingVideo = false | 205 | this.isUploadingVideo = false |
202 | this.videoUploadPercents = 0 | 206 | this.videoUploadPercents = 0 |
203 | this.videoUploadObservable = null | 207 | this.videoUploadObservable = null |
208 | this.firstStepError.emit() | ||
204 | this.notificationsService.error(this.i18n('Error'), err.message) | 209 | this.notificationsService.error(this.i18n('Error'), err.message) |
205 | } | 210 | } |
206 | ) | 211 | ) |
@@ -235,8 +240,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
235 | }, | 240 | }, |
236 | 241 | ||
237 | err => { | 242 | err => { |
238 | this.isUpdatingVideo = false | 243 | this.error = err.message |
239 | this.notificationsService.error(this.i18n('Error'), err.message) | 244 | scrollToTop() |
240 | console.error(err) | 245 | console.error(err) |
241 | } | 246 | } |
242 | ) | 247 | ) |
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html index e14e23aed..72a233b72 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html | |||
@@ -6,24 +6,24 @@ | |||
6 | 6 | ||
7 | <ngb-tabset class="video-add-tabset root-tabset bootstrap" [ngClass]="{ 'hide-nav': secondStepType !== undefined }"> | 7 | <ngb-tabset class="video-add-tabset root-tabset bootstrap" [ngClass]="{ 'hide-nav': secondStepType !== undefined }"> |
8 | 8 | ||
9 | <ngb-tab i18n-title title=""> | 9 | <ngb-tab> |
10 | <ng-template ngbTabTitle><span i18n>Upload a file</span></ng-template> | 10 | <ng-template ngbTabTitle><span i18n>Upload a file</span></ng-template> |
11 | <ng-template ngbTabContent> | 11 | <ng-template ngbTabContent> |
12 | <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)"></my-video-upload> | 12 | <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)" (firstStepError)="onError()"></my-video-upload> |
13 | </ng-template> | 13 | </ng-template> |
14 | </ngb-tab> | 14 | </ngb-tab> |
15 | 15 | ||
16 | <ngb-tab *ngIf="isVideoImportHttpEnabled()"> | 16 | <ngb-tab *ngIf="isVideoImportHttpEnabled()"> |
17 | <ng-template ngbTabTitle><span i18n>Import with URL</span></ng-template> | 17 | <ng-template ngbTabTitle><span i18n>Import with URL</span></ng-template> |
18 | <ng-template ngbTabContent> | 18 | <ng-template ngbTabContent> |
19 | <my-video-import-url #videoImportUrl (firstStepDone)="onFirstStepDone('import-url', $event)"></my-video-import-url> | 19 | <my-video-import-url #videoImportUrl (firstStepDone)="onFirstStepDone('import-url', $event)" (firstStepError)="onError()"></my-video-import-url> |
20 | </ng-template> | 20 | </ng-template> |
21 | </ngb-tab> | 21 | </ngb-tab> |
22 | 22 | ||
23 | <ngb-tab *ngIf="isVideoImportTorrentEnabled()"> | 23 | <ngb-tab *ngIf="isVideoImportTorrentEnabled()"> |
24 | <ng-template ngbTabTitle><span i18n>Import with torrent</span></ng-template> | 24 | <ng-template ngbTabTitle><span i18n>Import with torrent</span></ng-template> |
25 | <ng-template ngbTabContent> | 25 | <ng-template ngbTabContent> |
26 | <my-video-import-torrent #videoImportTorrent (firstStepDone)="onFirstStepDone('import-torrent', $event)"></my-video-import-torrent> | 26 | <my-video-import-torrent #videoImportTorrent (firstStepDone)="onFirstStepDone('import-torrent', $event)" (firstStepError)="onError()"></my-video-import-torrent> |
27 | </ng-template> | 27 | </ng-template> |
28 | </ngb-tab> | 28 | </ngb-tab> |
29 | </ngb-tabset> | 29 | </ngb-tabset> |
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 1a9247dbe..57a9d0ca7 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -27,6 +27,11 @@ export class VideoAddComponent implements CanComponentDeactivate { | |||
27 | this.videoName = videoName | 27 | this.videoName = videoName |
28 | } | 28 | } |
29 | 29 | ||
30 | onError () { | ||
31 | this.videoName = undefined | ||
32 | this.secondStepType = undefined | ||
33 | } | ||
34 | |||
30 | canDeactivate () { | 35 | canDeactivate () { |
31 | if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate() | 36 | if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate() |
32 | if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate() | 37 | if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate() |
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 d0151ceb1..09ee96bdc 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -114,7 +114,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
114 | ) | 114 | ) |
115 | .pipe( | 115 | .pipe( |
116 | // If 401, the video is private or blacklisted so redirect to 404 | 116 | // If 401, the video is private or blacklisted so redirect to 404 |
117 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 404 ])) | 117 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ])) |
118 | ) | 118 | ) |
119 | .subscribe(([ video, captionsResult ]) => { | 119 | .subscribe(([ video, captionsResult ]) => { |
120 | const startTime = this.route.snapshot.queryParams.start | 120 | const startTime = this.route.snapshot.queryParams.start |
diff --git a/client/src/assets/player/images/tick.svg b/client/src/assets/player/images/tick-white.svg index d329e6bfb..d329e6bfb 100644 --- a/client/src/assets/player/images/tick.svg +++ b/client/src/assets/player/images/tick-white.svg | |||
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 40da5f1f7..4fd5a9be2 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -111,6 +111,8 @@ class PeerTubePlugin extends Plugin { | |||
111 | const muted = getStoredMute() | 111 | const muted = getStoredMute() |
112 | if (muted !== undefined) this.player.muted(muted) | 112 | if (muted !== undefined) this.player.muted(muted) |
113 | 113 | ||
114 | this.player.duration(options.videoDuration) | ||
115 | |||
114 | this.initializePlayer() | 116 | this.initializePlayer() |
115 | this.runTorrentInfoScheduler() | 117 | this.runTorrentInfoScheduler() |
116 | this.runViewAdd() | 118 | this.runViewAdd() |
@@ -302,6 +304,9 @@ class PeerTubePlugin extends Plugin { | |||
302 | 304 | ||
303 | this.flushVideoFile(previousVideoFile) | 305 | this.flushVideoFile(previousVideoFile) |
304 | 306 | ||
307 | // Update progress bar (just for the UI), do not wait rendering | ||
308 | if (options.seek) this.player.currentTime(options.seek) | ||
309 | |||
305 | const renderVideoOptions = { autoplay: false, controls: true } | 310 | const renderVideoOptions = { autoplay: false, controls: true } |
306 | renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => { | 311 | renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => { |
307 | this.renderer = renderer | 312 | this.renderer = renderer |
diff --git a/client/src/sass/player/settings-menu.scss b/client/src/sass/player/settings-menu.scss index d065e72fb..61965c85e 100644 --- a/client/src/sass/player/settings-menu.scss +++ b/client/src/sass/player/settings-menu.scss | |||
@@ -171,7 +171,7 @@ $setting-transition-easing: ease-out; | |||
171 | left: 8px; | 171 | left: 8px; |
172 | content: ' '; | 172 | content: ' '; |
173 | margin-top: 1px; | 173 | margin-top: 1px; |
174 | background-image: url('#{$assets-path}/player/images/tick.svg'); | 174 | background-image: url('#{$assets-path}/player/images/tick-white.svg'); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
@@ -197,4 +197,4 @@ $setting-transition-easing: ease-out; | |||
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | } \ No newline at end of file | 200 | } |