forked from AkkomaGang/admin-fe
Fix parsing and wrapping mime_types setting
This commit is contained in:
parent
00dce737ae
commit
39abd05b3f
4 changed files with 26 additions and 13 deletions
|
@ -13,6 +13,8 @@ const getValueWithoutKey = (key, [type, value]) => {
|
||||||
updatedArray[index] = { 'tuple': ['ExSyslogger', ':ex_syslogger'] }
|
updatedArray[index] = { 'tuple': ['ExSyslogger', ':ex_syslogger'] }
|
||||||
}
|
}
|
||||||
return updatedArray
|
return updatedArray
|
||||||
|
} else if (key === ':types') {
|
||||||
|
return Object.keys(value).reduce((acc, key) => { return { ...acc, [key]: value[key][1] } }, {})
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,6 @@ const parseProxyUrl = value => {
|
||||||
|
|
||||||
export const partialUpdate = (group, key) => {
|
export const partialUpdate = (group, key) => {
|
||||||
if ((group === ':pleroma' && key === 'Oban') ||
|
if ((group === ':pleroma' && key === 'Oban') ||
|
||||||
(group === ':mime' && key === ':types') ||
|
|
||||||
(group === ':auto_linker' && key === ':opts')) {
|
(group === ':auto_linker' && key === ':opts')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inputValue() {
|
inputValue() {
|
||||||
if ([':esshd', ':cors_plug', ':quack', ':http_signatures'].includes(this.settingGroup.group) &&
|
if ([':esshd', ':cors_plug', ':quack', ':http_signatures', ':tesla'].includes(this.settingGroup.group) &&
|
||||||
this.data[this.setting.key]) {
|
this.data[this.setting.key]) {
|
||||||
return this.setting.type === 'atom' && this.data[this.setting.key].value[0] === ':'
|
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.substr(1)
|
||||||
|
@ -149,6 +149,8 @@ export default {
|
||||||
this.setting.key === 'Pleroma.Web.Auth.Authenticator' ||
|
this.setting.key === 'Pleroma.Web.Auth.Authenticator' ||
|
||||||
this.setting.key === ':admin_token') {
|
this.setting.key === ':admin_token') {
|
||||||
return this.data.value
|
return this.data.value
|
||||||
|
} else if (this.settingGroup.group === ':mime' && this.settingParent.key === ':types') {
|
||||||
|
return this.data.value[this.setting.key]
|
||||||
} else if (this.setting.type === 'atom') {
|
} else if (this.setting.type === 'atom') {
|
||||||
return this.data[this.setting.key] && this.data[this.setting.key][0] === ':' ? this.data[this.setting.key].substr(1) : this.data[this.setting.key]
|
return this.data[this.setting.key] && this.data[this.setting.key][0] === ':' ? this.data[this.setting.key].substr(1) : this.data[this.setting.key]
|
||||||
} else {
|
} else {
|
||||||
|
@ -177,12 +179,23 @@ export default {
|
||||||
},
|
},
|
||||||
processNestedData(value, group, key, parentInput, parentType, childInput, childType) {
|
processNestedData(value, group, key, parentInput, parentType, childInput, childType) {
|
||||||
const valueExists = value => value[group] && value[group][key] && value[group][key][parentInput]
|
const valueExists = value => value[group] && value[group][key] && value[group][key][parentInput]
|
||||||
const updatedValueForState = valueExists(this.settings)
|
let updatedValueForState = valueExists(this.settings)
|
||||||
? { ...this.settings[group][key][parentInput], ...{ [childInput]: value }}
|
? { ...this.settings[group][key][parentInput], ...{ [childInput]: value }}
|
||||||
: { [childInput]: value }
|
: { [childInput]: value }
|
||||||
const updatedValue = valueExists(this.updatedSettings)
|
let updatedValue = valueExists(this.updatedSettings)
|
||||||
? { ...this.updatedSettings[group][key][parentInput][1], ...{ [childInput]: [childType, value] }}
|
? { ...this.updatedSettings[group][key][parentInput][1], ...{ [childInput]: [childType, value] }}
|
||||||
: { [childInput]: [childType, value] }
|
: { [childInput]: [childType, value] }
|
||||||
|
|
||||||
|
if (group === ':mime' && parentInput === ':types') {
|
||||||
|
updatedValueForState = { ...this.settings[group][parentInput].value, ...updatedValueForState }
|
||||||
|
updatedValue = {
|
||||||
|
...Object.keys(this.settings[group][parentInput].value)
|
||||||
|
.reduce((acc, el) => {
|
||||||
|
return { ...acc, [el]: [['list', 'string'], this.settings[group][parentInput].value[el]] }
|
||||||
|
}, {}),
|
||||||
|
...updatedValue
|
||||||
|
}
|
||||||
|
}
|
||||||
this.$store.dispatch('UpdateSettings', { group, key, input: parentInput, value: updatedValue, type: parentType })
|
this.$store.dispatch('UpdateSettings', { group, key, input: parentInput, value: updatedValue, type: parentType })
|
||||||
this.$store.dispatch('UpdateState', { group, key, input: parentInput, value: updatedValueForState })
|
this.$store.dispatch('UpdateState', { group, key, input: parentInput, value: updatedValueForState })
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,13 +38,13 @@ export default {
|
||||||
return this.settings.description.find(setting => setting.group === ':mime')
|
return this.settings.description.find(setting => setting.group === ':mime')
|
||||||
},
|
},
|
||||||
mimeTypesData() {
|
mimeTypesData() {
|
||||||
return this.settings.settings[':mime'][':types']
|
return this.settings.settings[':mime']
|
||||||
},
|
},
|
||||||
teslaAdapter() {
|
teslaAdapter() {
|
||||||
return this.settings.description.find(setting => setting.group === ':tesla')
|
return this.settings.description.find(setting => setting.group === ':tesla')
|
||||||
},
|
},
|
||||||
teslaAdapterData() {
|
teslaAdapterData() {
|
||||||
return this.settings.settings[':tesla'][':adapter']
|
return this.settings.settings[':tesla']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -56,21 +56,20 @@
|
||||||
<el-tab-pane :label="$t('settings.rateLimiters')" lazy>
|
<el-tab-pane :label="$t('settings.rateLimiters')" lazy>
|
||||||
<rate-limiters/>
|
<rate-limiters/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!--
|
|
||||||
<el-tab-pane :label="$t('settings.mediaProxy')" lazy>
|
|
||||||
<media-proxy/>
|
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane :label="$t('settings.relays')" lazy>
|
<el-tab-pane :label="$t('settings.relays')" lazy>
|
||||||
<relays/>
|
<relays/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('settings.other')" lazy>
|
||||||
|
<other/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<!-- <el-tab-pane :label="$t('settings.mediaProxy')" lazy>
|
||||||
|
<media-proxy/>
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('settings.upload')" lazy>
|
<el-tab-pane :label="$t('settings.upload')" lazy>
|
||||||
<upload/>
|
<upload/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('settings.webPush')" lazy>
|
<el-tab-pane :label="$t('settings.webPush')" lazy>
|
||||||
<web-push/>
|
<web-push/>
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane :label="$t('settings.other')" lazy>
|
|
||||||
<other/>
|
|
||||||
</el-tab-pane> -->
|
</el-tab-pane> -->
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue