Add settings groups to state, update ActivityPub, Auth, Captcha tabs

This commit is contained in:
Angelina Filippova 2019-11-19 00:56:32 +09:00
parent c655882e6e
commit 4a17d2275a
4 changed files with 25 additions and 21 deletions

View file

@ -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

View file

@ -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: {

View file

@ -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: {

View file

@ -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'