- const newCustomizationJavascript = this.form.value['customizationJavascript']
- const newCustomizationCSS = this.form.value['customizationCSS']
-
- const customizations = []
- if (newCustomizationJavascript && newCustomizationJavascript !== this.oldCustomJavascript) customizations.push('JavaScript')
- if (newCustomizationCSS && newCustomizationCSS !== this.oldCustomCSS) customizations.push('CSS')
-
- if (customizations.length !== 0) {
- const customizationsText = customizations.join('/')
-
- const message = `You set custom ${customizationsText}. ` +
- 'This could lead to security issues or bugs if you do not understand it. ' +
- 'Are you sure you want to update the configuration?'
- const label = `Please type "I understand the ${customizationsText} I set" to confirm.`
- const expectedInputValue = `I understand the ${customizationsText} I set`
-
- const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
- if (confirmRes === false) return
- }
-
- const data = {
- instance: {
- name: this.form.value['instanceName'],
- description: this.form.value['instanceDescription'],
- terms: this.form.value['instanceTerms'],
- customizations: {
- javascript: this.form.value['customizationJavascript'],
- css: this.form.value['customizationCSS']
- }
- },
- cache: {
- previews: {
- size: this.form.value['cachePreviewsSize']
- }
- },
- signup: {
- enabled: this.form.value['signupEnabled'],
- limit: this.form.value['signupLimit']
- },
- admin: {
- email: this.form.value['adminEmail']
- },
- user: {
- videoQuota: this.form.value['userVideoQuota']
- },
- transcoding: {
- enabled: this.form.value['transcodingEnabled'],
- threads: this.form.value['transcodingThreads'],
- resolutions: {
- '240p': this.form.value[this.getResolutionKey('240p')],
- '360p': this.form.value[this.getResolutionKey('360p')],
- '480p': this.form.value[this.getResolutionKey('480p')],
- '720p': this.form.value[this.getResolutionKey('720p')],
- '1080p': this.form.value[this.getResolutionKey('1080p')]
- }
- }
- }
-
- this.configService.updateCustomConfig(data)