diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index 3dc6d1a5..fd244ec0 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -71,7 +71,10 @@ const parseObject = object => { } const parseProxyUrl = value => { - if (!Array.isArray(value) && typeof value === 'object' && value.tuple.length === 3 && value.tuple[0] === ':socks5') { + if (value && !Array.isArray(value) && + typeof value === 'object' && + value.tuple.length === 3 && + value.tuple[0] === ':socks5') { const [, host, port] = value.tuple return { socks5: true, host, port } } else if (typeof value === 'string') { @@ -83,7 +86,6 @@ const parseProxyUrl = value => { export const partialUpdate = (group, key) => { if ((group === ':pleroma' && key === ':ecto_repos') || - (group === ':quack' && key === ':meta') || (group === ':mime' && key === ':types') || (group === ':auto_linker' && key === ':opts') || (group === ':swarm' && key === ':node_blacklist')) { @@ -107,8 +109,13 @@ export const valueHasTuples = (key, value) => { export const wrapUpdatedSettings = (group, settings) => { return Object.keys(settings).map((key) => { - const value = settings[key]._value ? settings[key]._value[1] : wrapValues(settings[key]) - return { group, key, value } + if (settings[key]._value) { + const value = settings[key]._value[0] === 'atom' && settings[key]._value[1].length > 1 + ? `:${settings[key]._value[1]}` + : settings[key]._value[1] + return { group, key, value } + } + return { group, key, value: wrapValues(settings[key]) } }) } @@ -117,7 +124,7 @@ const wrapValues = settings => { const [type, value] = Array.isArray(settings[setting]) ? settings[setting] : ['', settings[setting]] if (type === 'keyword' || type.includes('keyword')) { return { 'tuple': [setting, wrapValues(value)] } - } else if (type === 'atom') { + } else if (type === 'atom' && value.length > 0) { return { 'tuple': [setting, `:${value}`] } } else if (type.includes('tuple') && Array.isArray(value)) { return { 'tuple': [setting, { 'tuple': value }] } diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 17d3aacf..8d805935 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -185,7 +185,9 @@ export default { inputValue() { if ([':esshd', ':cors_plug', ':quack', ':http_signatures'].includes(this.settingGroup.group) && this.data[this.setting.key]) { - return this.data[this.setting.key].value + return this.setting.type === 'atom' && this.data[this.setting.key].value[0] === ':' + ? this.data[this.setting.key].value.substr(1) + : this.data[this.setting.key].value } else if ((this.settingGroup.group === ':logger' && this.setting.key === ':backends') || this.setting.key === 'Pleroma.Web.Auth.Authenticator' || this.setting.key === ':admin_token') { diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 61ad70d1..d77ec950 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -38,13 +38,14 @@ + + +