From 5700f3625026d2fd32e603c4ff884e4a3384783d Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 18 Dec 2019 17:36:40 +0300 Subject: [PATCH] Process ssl options in a separate tab, parse and wrap other setting from HTTP tab --- src/store/modules/normalizers.js | 9 +- src/views/settings/components/Http.vue | 2 +- src/views/settings/components/Inputs.vue | 8 +- .../inputComponents/SslOptionsInput.vue | 82 +++++++++++++++++++ .../components/inputComponents/index.js | 1 + src/views/settings/index.vue | 7 +- 6 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 src/views/settings/components/inputComponents/SslOptionsInput.vue diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index 5b7f6ff1..3dc6d1a5 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -3,8 +3,6 @@ const nonAtomsObjects = ['match_actor', ':match_actor'] const objects = ['digest', 'pleroma_fe', 'masto_fe', 'poll_limits', 'styling'] const objectParents = ['mascots'] -const groupWithoutKey = settings => settings._value ? settings._value[1] : false - // REFACTOR export const parseTuples = (tuples, key) => { return tuples.reduce((accum, item) => { @@ -88,8 +86,7 @@ export const partialUpdate = (group, key) => { (group === ':quack' && key === ':meta') || (group === ':mime' && key === ':types') || (group === ':auto_linker' && key === ':opts') || - (group === ':swarm' && key === ':node_blacklist') || - (group === ':cors_plug' && [':max_age', ':methods', ':expose', ':headers'].includes(key))) { + (group === ':swarm' && key === ':node_blacklist')) { return false } return true @@ -110,7 +107,7 @@ export const valueHasTuples = (key, value) => { export const wrapUpdatedSettings = (group, settings) => { return Object.keys(settings).map((key) => { - const value = groupWithoutKey(settings[key]) || wrapValues(settings[key]) + const value = settings[key]._value ? settings[key]._value[1] : wrapValues(settings[key]) return { group, key, value } }) } @@ -133,6 +130,8 @@ const wrapValues = settings => { } else if (setting === ':ip') { const ip = value.split('.').map(s => parseInt(s, 10)) return { 'tuple': [setting, { 'tuple': ip }] } + } else if (setting === ':ssl_options') { + return { 'tuple': [setting, wrapValues(value)] } } else { return { 'tuple': [setting, value] } } diff --git a/src/views/settings/components/Http.vue b/src/views/settings/components/Http.vue index 37100fbf..03689a96 100644 --- a/src/views/settings/components/Http.vue +++ b/src/views/settings/components/Http.vue @@ -59,7 +59,7 @@ export default { return this.settings.description.find(setting => setting.group === ':http_signatures') }, httpSignaturesData() { - return this.settings.settings.http_signatures + return this.settings.settings[':http_signatures'] }, isMobile() { return this.$store.state.app.device === 'mobile' diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index b93f7894..17d3aacf 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -11,7 +11,7 @@ @change="update($event, settingGroup.group, settingGroup.key, settingParent, setting.key, setting.type, nested)"/> +

{{ setting.description }}

@@ -119,7 +120,7 @@ import AceEditor from 'vue2-ace-editor' import 'brace/mode/elixir' import 'default-passive-events' -import { AutoLinkerInput, EditableKeywordInput, IconsInput, MascotsInput, ProxyUrlInput } from './inputComponents' +import { AutoLinkerInput, EditableKeywordInput, IconsInput, MascotsInput, ProxyUrlInput, SslOptionsInput } from './inputComponents' export default { name: 'Inputs', @@ -129,7 +130,8 @@ export default { EditableKeywordInput, IconsInput, MascotsInput, - ProxyUrlInput + ProxyUrlInput, + SslOptionsInput }, props: { customLabelWidth: { diff --git a/src/views/settings/components/inputComponents/SslOptionsInput.vue b/src/views/settings/components/inputComponents/SslOptionsInput.vue new file mode 100644 index 00000000..a613ee9e --- /dev/null +++ b/src/views/settings/components/inputComponents/SslOptionsInput.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/views/settings/components/inputComponents/index.js b/src/views/settings/components/inputComponents/index.js index 7793db17..ee145423 100644 --- a/src/views/settings/components/inputComponents/index.js +++ b/src/views/settings/components/inputComponents/index.js @@ -3,3 +3,4 @@ export { default as MascotsInput } from './MascotsInput' export { default as EditableKeywordInput } from './EditableKeywordInput' export { default as IconsInput } from './IconsInput' export { default as ProxyUrlInput } from './ProxyUrlInput' +export { default as SslOptionsInput } from './SslOptionsInput' diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 53e471e0..61ad70d1 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -32,14 +32,13 @@ + + +