diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-03 11:10:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-06 11:19:16 +0200 |
commit | 5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e (patch) | |
tree | dd992ea798c620b8bdb5bf5fd9b8f1b97d4410f2 /client/src | |
parent | 7e5f9f001d5de22c54748f935edc0c069028bb0e (diff) | |
download | PeerTube-5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e.tar.gz PeerTube-5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e.tar.zst PeerTube-5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e.zip |
Add import http enabled configuration
Diffstat (limited to 'client/src')
8 files changed, 50 insertions, 4 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 6e3f83ccf..13b43306b 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -101,6 +101,13 @@ | |||
101 | </div> | 101 | </div> |
102 | </div> | 102 | </div> |
103 | 103 | ||
104 | <div i18n class="inner-form-title">Import</div> | ||
105 | |||
106 | <my-peertube-checkbox | ||
107 | inputName="importVideosHttpEnabled" formControlName="importVideosHttpEnabled" | ||
108 | i18n-labelText labelText="Video import with HTTP enabled" | ||
109 | ></my-peertube-checkbox> | ||
110 | |||
104 | <div i18n class="inner-form-title">Administrator</div> | 111 | <div i18n class="inner-form-title">Administrator</div> |
105 | 112 | ||
106 | <div class="form-group"> | 113 | <div class="form-group"> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index e614c1892..bc5ce6e5d 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -71,6 +71,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
71 | cacheCaptionsSize: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE, | 71 | cacheCaptionsSize: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE, |
72 | signupEnabled: null, | 72 | signupEnabled: null, |
73 | signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT, | 73 | signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT, |
74 | importVideosHttpEnabled: null, | ||
74 | adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, | 75 | adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, |
75 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, | 76 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, |
76 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, | 77 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, |
@@ -183,6 +184,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
183 | '720p': this.form.value[this.getResolutionKey('720p')], | 184 | '720p': this.form.value[this.getResolutionKey('720p')], |
184 | '1080p': this.form.value[this.getResolutionKey('1080p')] | 185 | '1080p': this.form.value[this.getResolutionKey('1080p')] |
185 | } | 186 | } |
187 | }, | ||
188 | import: { | ||
189 | videos: { | ||
190 | http: { | ||
191 | enabled: this.form.value['importVideosHttpEnabled'] | ||
192 | } | ||
193 | } | ||
186 | } | 194 | } |
187 | } | 195 | } |
188 | 196 | ||
@@ -222,7 +230,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
222 | transcodingThreads: this.customConfig.transcoding.threads, | 230 | transcodingThreads: this.customConfig.transcoding.threads, |
223 | transcodingEnabled: this.customConfig.transcoding.enabled, | 231 | transcodingEnabled: this.customConfig.transcoding.enabled, |
224 | customizationJavascript: this.customConfig.instance.customizations.javascript, | 232 | customizationJavascript: this.customConfig.instance.customizations.javascript, |
225 | customizationCSS: this.customConfig.instance.customizations.css | 233 | customizationCSS: this.customConfig.instance.customizations.css, |
234 | importVideosHttpEnabled: this.customConfig.import.videos.http.enabled | ||
226 | } | 235 | } |
227 | 236 | ||
228 | for (const resolution of this.resolutions) { | 237 | for (const resolution of this.resolutions) { |
diff --git a/client/src/app/+my-account/my-account.component.html b/client/src/app/+my-account/my-account.component.html index f67245d85..ddb0570db 100644 --- a/client/src/app/+my-account/my-account.component.html +++ b/client/src/app/+my-account/my-account.component.html | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | <a i18n routerLink="/my-account/videos" routerLinkActive="active" class="title-page">My videos</a> | 7 | <a i18n routerLink="/my-account/videos" routerLinkActive="active" class="title-page">My videos</a> |
8 | 8 | ||
9 | <a i18n routerLink="/my-account/video-imports" routerLinkActive="active" class="title-page">My video imports</a> | 9 | <a *ngIf="isVideoImportEnabled()" i18n routerLink="/my-account/video-imports" routerLinkActive="active" class="title-page">My video imports</a> |
10 | </div> | 10 | </div> |
11 | 11 | ||
12 | <div class="margin-content"> | 12 | <div class="margin-content"> |
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index 7bb461d3c..a8f5f8f31 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts | |||
@@ -1,7 +1,17 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component } from '@angular/core' |
2 | import { ServerService } from '@app/core' | ||
2 | 3 | ||
3 | @Component({ | 4 | @Component({ |
4 | selector: 'my-my-account', | 5 | selector: 'my-my-account', |
5 | templateUrl: './my-account.component.html' | 6 | templateUrl: './my-account.component.html' |
6 | }) | 7 | }) |
7 | export class MyAccountComponent {} | 8 | export class MyAccountComponent { |
9 | |||
10 | constructor ( | ||
11 | private serverService: ServerService | ||
12 | ) {} | ||
13 | |||
14 | isVideoImportEnabled () { | ||
15 | return this.serverService.getConfig().import.video.http.enabled | ||
16 | } | ||
17 | } | ||
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 7b11c068e..e2254b7b5 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -68,6 +68,13 @@ export class ServerService { | |||
68 | }, | 68 | }, |
69 | user: { | 69 | user: { |
70 | videoQuota: -1 | 70 | videoQuota: -1 |
71 | }, | ||
72 | import: { | ||
73 | video: { | ||
74 | http: { | ||
75 | enabled: false | ||
76 | } | ||
77 | } | ||
71 | } | 78 | } |
72 | } | 79 | } |
73 | private videoCategories: Array<VideoConstant<string>> = [] | 80 | private videoCategories: Array<VideoConstant<string>> = [] |
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 ed8d91c11..1575007d2 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html | |||
@@ -10,7 +10,7 @@ | |||
10 | <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)"></my-video-upload> | 10 | <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)"></my-video-upload> |
11 | </tab> | 11 | </tab> |
12 | 12 | ||
13 | <tab i18n-heading heading="Import your video"> | 13 | <tab *ngIf="isVideoImportEnabled()" i18n-heading heading="Import your video"> |
14 | <my-video-import #videoImport (firstStepDone)="onFirstStepDone('import', $event)"></my-video-import> | 14 | <my-video-import #videoImport (firstStepDone)="onFirstStepDone('import', $event)"></my-video-import> |
15 | </tab> | 15 | </tab> |
16 | </tabset> | 16 | </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 64071b40c..d38a53db9 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, ViewChild } from '@angular/core' | |||
2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' |
3 | import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' | 3 | import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' |
4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' | 4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' |
5 | import { ServerService } from '@app/core' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-videos-add', | 8 | selector: 'my-videos-add', |
@@ -15,6 +16,10 @@ export class VideoAddComponent implements CanComponentDeactivate { | |||
15 | secondStepType: 'upload' | 'import' | 16 | secondStepType: 'upload' | 'import' |
16 | videoName: string | 17 | videoName: string |
17 | 18 | ||
19 | constructor ( | ||
20 | private serverService: ServerService | ||
21 | ) {} | ||
22 | |||
18 | onFirstStepDone (type: 'upload' | 'import', videoName: string) { | 23 | onFirstStepDone (type: 'upload' | 'import', videoName: string) { |
19 | this.secondStepType = type | 24 | this.secondStepType = type |
20 | this.videoName = videoName | 25 | this.videoName = videoName |
@@ -26,4 +31,8 @@ export class VideoAddComponent implements CanComponentDeactivate { | |||
26 | 31 | ||
27 | return { canDeactivate: true } | 32 | return { canDeactivate: true } |
28 | } | 33 | } |
34 | |||
35 | isVideoImportEnabled () { | ||
36 | return this.serverService.getConfig().import.video.http.enabled | ||
37 | } | ||
29 | } | 38 | } |
diff --git a/client/src/app/videos/+video-edit/video-import.component.ts b/client/src/app/videos/+video-edit/video-import.component.ts index bd4482e17..b1e8e0205 100644 --- a/client/src/app/videos/+video-edit/video-import.component.ts +++ b/client/src/app/videos/+video-edit/video-import.component.ts | |||
@@ -97,8 +97,11 @@ export class VideoImportComponent extends FormReactive implements OnInit, CanCom | |||
97 | channelId: this.firstStepChannelId | 97 | channelId: this.firstStepChannelId |
98 | } | 98 | } |
99 | 99 | ||
100 | this.loadingBar.start() | ||
101 | |||
100 | this.videoImportService.importVideo(this.targetUrl, videoUpdate).subscribe( | 102 | this.videoImportService.importVideo(this.targetUrl, videoUpdate).subscribe( |
101 | res => { | 103 | res => { |
104 | this.loadingBar.complete() | ||
102 | this.firstStepDone.emit(res.video.name) | 105 | this.firstStepDone.emit(res.video.name) |
103 | this.isImportingVideo = false | 106 | this.isImportingVideo = false |
104 | this.hasImportedVideo = true | 107 | this.hasImportedVideo = true |
@@ -113,6 +116,7 @@ export class VideoImportComponent extends FormReactive implements OnInit, CanCom | |||
113 | }, | 116 | }, |
114 | 117 | ||
115 | err => { | 118 | err => { |
119 | this.loadingBar.complete() | ||
116 | this.isImportingVideo = false | 120 | this.isImportingVideo = false |
117 | this.notificationsService.error(this.i18n('Error'), err.message) | 121 | this.notificationsService.error(this.i18n('Error'), err.message) |
118 | } | 122 | } |