- ngOnInit () {
- const formGroupData = {
- instanceName: this.customConfigValidatorsService.INSTANCE_NAME,
- instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION,
- instanceDescription: null,
- instanceTerms: null,
- instanceDefaultClientRoute: null,
- instanceDefaultNSFWPolicy: null,
- servicesTwitterUsername: this.customConfigValidatorsService.SERVICES_TWITTER_USERNAME,
- servicesTwitterWhitelisted: null,
- cachePreviewsSize: this.customConfigValidatorsService.CACHE_PREVIEWS_SIZE,
- cacheCaptionsSize: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE,
- signupEnabled: null,
- signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT,
- adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL,
- userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
- transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS,
- transcodingEnabled: null,
- customizationJavascript: null,
- customizationCSS: null
- }
-
- const defaultValues: BuildFormDefaultValues = {}
- for (const resolution of this.resolutions) {
- const key = this.getResolutionKey(resolution)
- defaultValues[key] = 'false'
- formGroupData[key] = null
- }
-
- this.buildForm(formGroupData)
-
- this.configService.getCustomConfig()
- .subscribe(
- res => {
- this.customConfig = res
-
- this.oldCustomCSS = this.customConfig.instance.customizations.css
- this.oldCustomJavascript = this.customConfig.instance.customizations.javascript
-
- this.updateForm()
- // Force form validation
- this.forceCheck()
- },
-
- err => this.notificationsService.error(this.i18n('Error'), err.message)
- )