X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fconfig%2Fedit-custom-config%2Fedit-custom-config.component.ts;h=3fda0851efa9da12e0807788f120251cf6e8427d;hb=6a07a058616b3fb70e56cd4e50b8deb02a2468d0;hp=0a69f34819fc970f7132a83f40fb00cbc2096174;hpb=8d5e65349deebd499c0be10fe02d535a77d58ddb;p=github%2FChocobozzz%2FPeerTube.git 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 0a69f3481..3fda0851e 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 @@ -8,7 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { SelectItem } from 'primeng/api' import { forkJoin } from 'rxjs' -import { first } from 'rxjs/operators' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-edit-custom-config', @@ -18,12 +18,14 @@ import { first } from 'rxjs/operators' export class EditCustomConfigComponent extends FormReactive implements OnInit { customConfig: CustomConfig - resolutions: { id: string, label: string }[] = [] + resolutions: { id: string, label: string, description?: string }[] = [] transcodingThreadOptions: { label: string, value: number }[] = [] languageItems: SelectItem[] = [] categoryItems: SelectItem[] = [] + private serverConfig: ServerConfig + constructor ( protected formValidatorService: FormValidatorService, private customConfigValidatorsService: CustomConfigValidatorsService, @@ -36,6 +38,11 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { super() this.resolutions = [ + { + id: '0p', + label: this.i18n('Audio-only'), + description: this.i18n('A .mp4 that keeps the original audio track, with no video') + }, { id: '240p', label: this.i18n('240p') @@ -80,7 +87,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } get availableThemes () { - return this.serverService.getConfig().theme.registered + return this.serverConfig.theme.registered .map(t => t.name) } @@ -89,6 +96,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } ngOnInit () { + this.serverConfig = this.serverService.getTmpConfig() + this.serverService.getConfig() + .subscribe(config => this.serverConfig = config) + const formGroupData: { [key in keyof CustomConfig ]: any } = { instance: { name: this.customConfigValidatorsService.INSTANCE_NAME, @@ -166,7 +177,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { threads: this.customConfigValidatorsService.TRANSCODING_THREADS, allowAdditionalExtensions: null, allowAudioFiles: null, - resolutions: {} + resolutions: {}, + hls: { + enabled: null + }, + webtorrent: { + enabled: null + } }, autoBlacklist: { videos: { @@ -208,16 +225,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { forkJoin([ this.configService.getCustomConfig(), - this.serverService.videoLanguagesLoaded.pipe(first()), // First so the observable completes - this.serverService.videoCategoriesLoaded.pipe(first()) + this.serverService.getVideoLanguages(), + this.serverService.getVideoCategories() ]).subscribe( - ([ config ]) => { + ([ config, languages, categories ]) => { this.customConfig = config - const languages = this.serverService.getVideoLanguages() this.languageItems = languages.map(l => ({ label: l.label, value: l.id })) - - const categories = this.serverService.getVideoCategories() this.categoryItems = categories.map(l => ({ label: l.label, value: l.id })) this.updateForm() @@ -239,12 +253,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { async formValidated () { this.configService.updateCustomConfig(this.form.value) + .pipe( + ) .subscribe( res => { this.customConfig = res // Reload general configuration - this.serverService.loadConfig() + this.serverService.resetConfig() this.updateForm()