From 5d08a6a74e83f2e4dfe2f3ba7f5a39371e1bc89e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 3 Aug 2018 11:10:31 +0200 Subject: Add import http enabled configuration --- .../edit-custom-config/edit-custom-config.component.html | 7 +++++++ .../edit-custom-config/edit-custom-config.component.ts | 11 ++++++++++- client/src/app/+my-account/my-account.component.html | 2 +- client/src/app/+my-account/my-account.component.ts | 12 +++++++++++- client/src/app/core/server/server.service.ts | 7 +++++++ client/src/app/videos/+video-edit/video-add.component.html | 2 +- client/src/app/videos/+video-edit/video-add.component.ts | 9 +++++++++ client/src/app/videos/+video-edit/video-import.component.ts | 4 ++++ 8 files changed, 50 insertions(+), 4 deletions(-) (limited to 'client/src') 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 @@ +
Import
+ + +
Administrator
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 { cacheCaptionsSize: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE, signupEnabled: null, signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT, + importVideosHttpEnabled: null, adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, @@ -183,6 +184,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { '720p': this.form.value[this.getResolutionKey('720p')], '1080p': this.form.value[this.getResolutionKey('1080p')] } + }, + import: { + videos: { + http: { + enabled: this.form.value['importVideosHttpEnabled'] + } + } } } @@ -222,7 +230,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { transcodingThreads: this.customConfig.transcoding.threads, transcodingEnabled: this.customConfig.transcoding.enabled, customizationJavascript: this.customConfig.instance.customizations.javascript, - customizationCSS: this.customConfig.instance.customizations.css + customizationCSS: this.customConfig.instance.customizations.css, + importVideosHttpEnabled: this.customConfig.import.videos.http.enabled } 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 @@ My videos - My video imports + My video imports
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 @@ import { Component } from '@angular/core' +import { ServerService } from '@app/core' @Component({ selector: 'my-my-account', templateUrl: './my-account.component.html' }) -export class MyAccountComponent {} +export class MyAccountComponent { + + constructor ( + private serverService: ServerService + ) {} + + isVideoImportEnabled () { + return this.serverService.getConfig().import.video.http.enabled + } +} 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 { }, user: { videoQuota: -1 + }, + import: { + video: { + http: { + enabled: false + } + } } } private videoCategories: Array> = [] 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 @@ - + 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' import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' +import { ServerService } from '@app/core' @Component({ selector: 'my-videos-add', @@ -15,6 +16,10 @@ export class VideoAddComponent implements CanComponentDeactivate { secondStepType: 'upload' | 'import' videoName: string + constructor ( + private serverService: ServerService + ) {} + onFirstStepDone (type: 'upload' | 'import', videoName: string) { this.secondStepType = type this.videoName = videoName @@ -26,4 +31,8 @@ export class VideoAddComponent implements CanComponentDeactivate { return { canDeactivate: true } } + + isVideoImportEnabled () { + return this.serverService.getConfig().import.video.http.enabled + } } 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 channelId: this.firstStepChannelId } + this.loadingBar.start() + this.videoImportService.importVideo(this.targetUrl, videoUpdate).subscribe( res => { + this.loadingBar.complete() this.firstStepDone.emit(res.video.name) this.isImportingVideo = false this.hasImportedVideo = true @@ -113,6 +116,7 @@ export class VideoImportComponent extends FormReactive implements OnInit, CanCom }, err => { + this.loadingBar.complete() this.isImportingVideo = false this.notificationsService.error(this.i18n('Error'), err.message) } -- cgit v1.2.3