From 4a17d2275a192d122e82bfa858596fb8b767d1c2 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Tue, 19 Nov 2019 00:56:32 +0900 Subject: [PATCH] Add settings groups to state, update ActivityPub, Auth, Captcha tabs --- src/store/modules/settings.js | 30 +++++++++++-------- src/views/settings/components/ActivityPub.vue | 4 +-- .../settings/components/Authentication.vue | 8 ++--- src/views/settings/components/Captcha.vue | 4 +-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index 1c380247..584ea408 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -4,7 +4,21 @@ import { filterIgnored, parseTuples, valueHasTuples, wrapConfig } from './normal const settings = { state: { description: [], - settings: {}, + settings: { + auto_linker: {}, + cors_plug: {}, + esshd: {}, + http_signatures: {}, + logger: {}, + mime: {}, + phoenix: {}, + pleroma: {}, + prometheus: {}, + quack: {}, + tesla: {}, + ueberauth: {}, + web_push_encryption: {} + }, ignoredIfNotEnabled: ['enabled', 'handler', 'password_authenticator', 'port', 'priv_dir'], loading: true }, @@ -20,18 +34,8 @@ const settings = { }, SET_SETTINGS: (state, data) => { const newSettings = data.reduce((acc, { group, key, value }) => { - if (group === 'cors_plug') { - acc[':cors_plug'] = { ...acc[':cors_plug'], [key]: value } - } else if (group === 'logger') { - const parsedValue = valueHasTuples(key, value) ? value : parseTuples(value, key) - acc[':logger'] = acc[':logger'] ? { ...acc[':logger'], [key]: parsedValue } : { [key]: parsedValue } - } else if (group === 'quack') { - const parsedValue = valueHasTuples(key, value) ? value : parseTuples(value, key) - acc[':quack'] = acc[':quack'] ? { ...acc[':quack'], [key]: parsedValue } : { [key]: parsedValue } - } else { - const parsedValue = valueHasTuples(key, value) ? { value } : parseTuples(value, key) - acc[key] = { ...acc[key], ...parsedValue } - } + const parsedValue = valueHasTuples(key, value) ? { value } : parseTuples(value, key) + acc[group][key] = { ...acc[group][key], ...parsedValue } return acc }, state.settings) state.settings = newSettings diff --git a/src/views/settings/components/ActivityPub.vue b/src/views/settings/components/ActivityPub.vue index 0ec54f5d..0effc24d 100644 --- a/src/views/settings/components/ActivityPub.vue +++ b/src/views/settings/components/ActivityPub.vue @@ -29,7 +29,7 @@ export default { return this.settings.description.find(setting => setting.key === ':activitypub') }, activitypubData() { - return this.settings.settings[':activitypub'] + return this.settings.settings.pleroma[':activitypub'] }, isMobile() { return this.$store.state.app.device === 'mobile' @@ -44,7 +44,7 @@ export default { return this.settings.description.find(setting => setting.key === ':user') }, userData() { - return this.settings.settings[':user'] + return this.settings.settings.pleroma[':user'] } }, methods: { diff --git a/src/views/settings/components/Authentication.vue b/src/views/settings/components/Authentication.vue index 502b9694..72e7ad91 100644 --- a/src/views/settings/components/Authentication.vue +++ b/src/views/settings/components/Authentication.vue @@ -37,7 +37,7 @@ export default { return this.settings.description.find(setting => setting.key === ':auth') }, authData() { - return this.settings.settings[':auth'] + return this.settings.settings.pleroma[':auth'] }, isMobile() { return this.$store.state.app.device === 'mobile' @@ -49,7 +49,7 @@ export default { return this.settings.description.find(setting => setting.key === ':ldap') }, ldapData() { - return this.settings.settings[':ldap'] + return this.settings.settings.pleroma[':ldap'] }, loading() { return this.settings.loading @@ -58,13 +58,13 @@ export default { return this.settings.description.find(setting => setting.key === ':oauth2') }, oauth2Data() { - return this.settings.settings[':oauth2'] + return this.settings.settings.pleroma[':oauth2'] }, pleromaAuthenticator() { return this.settings.description.find(setting => setting.description === 'Authenticator') }, pleromaAuthenticatorData() { - return this.settings.settings[''] + return this.settings.settings.pleroma['Pleroma.Web.Auth.Authenticator'] } }, methods: { diff --git a/src/views/settings/components/Captcha.vue b/src/views/settings/components/Captcha.vue index abaa897e..44e3ea05 100644 --- a/src/views/settings/components/Captcha.vue +++ b/src/views/settings/components/Captcha.vue @@ -29,7 +29,7 @@ export default { return this.settings.description.find(setting => setting.key === 'Pleroma.Captcha') }, captchaData() { - return this.settings.settings['Pleroma.Captcha'] + return this.settings.settings.pleroma['Pleroma.Captcha'] }, isMobile() { return this.$store.state.app.device === 'mobile' @@ -38,7 +38,7 @@ export default { return this.settings.description.find(setting => setting.key === 'Pleroma.Captcha.Kocaptcha') }, kocaptchaData() { - return this.settings.settings['Pleroma.Captcha.Kocaptcha'] + return this.settings.settings.pleroma['Pleroma.Captcha.Kocaptcha'] }, labelWidth() { return this.isMobile ? '100px' : '240px'