+ async formValidated () {
+ 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('/')
+
+ // FIXME: i18n service does not support string concatenation
+ const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) +
+ this.i18n('This could lead to security issues or bugs if you do not understand it. ') +
+ this.i18n('Are you sure you want to update the configuration?')
+ const label = this.i18n(
+ 'Please type "I understand the {{customizationsText}} I set" to confirm.',
+ { customizationsText }
+ )
+ const expectedInputValue = this.i18n('I understand the {{customizationsText}} I set', { customizationsText })
+
+ const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
+ if (confirmRes === false) return
+ }
+
+ const data: CustomConfig = {
+ instance: {
+ name: this.form.value['instanceName'],
+ shortDescription: this.form.value['instanceShortDescription'],
+ description: this.form.value['instanceDescription'],
+ terms: this.form.value['instanceTerms'],
+ defaultClientRoute: this.form.value['instanceDefaultClientRoute'],
+ defaultNSFWPolicy: this.form.value['instanceDefaultNSFWPolicy'],
+ customizations: {
+ javascript: this.form.value['customizationJavascript'],
+ css: this.form.value['customizationCSS']
+ }
+ },
+ services: {
+ twitter: {
+ username: this.form.value['servicesTwitterUsername'],
+ whitelisted: this.form.value['servicesTwitterWhitelisted']
+ }
+ },