diff --git a/CHANGELOG.md b/CHANGELOG.md index d7a6de16..bd324b81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add Report show page and link Moderation log references to the respective reports - Add Unconfimed filter for Users table - Filter users by actor type: Person, Bot or Application -- Add ability to configure Media Preview Proxy, User Backup and Websocket based federation settings +- Add ability to configure Media Preview Proxy, User Backup, Websocket based federation and Pleroma.Web.Endpoint.MetricsExporter settings - Mobile and Tablet UI for Single Report show page ### Changed @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Move `:restrict_unauthenticated` settings from Authentication tab to Instance tab - Replace regular inputs with textareas for setting welcome messages in the Settings section - Update rendering Moderation Log Messages so that all usernames are links to the pages of the corresponding users in Admin-FE +- Remove Websocket based federation settings ### Fixed diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index e647a4a7..150865d0 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -57,10 +57,18 @@ export const parseNonTuples = (key, value) => { // REFACTOR export const parseTuples = (tuples, key) => { return tuples.reduce((accum, item) => { - if (key === ':rate_limit') { - accum[item.tuple[0]] = Array.isArray(item.tuple[1]) - ? item.tuple[1].map(el => el.tuple) - : item.tuple[1].tuple + if (key === ':rate_limit' || + (key === 'Pleroma.Web.Endpoint.MetricsExporter' && item.tuple[0] === ':auth')) { + const getValue = () => { + if (typeof item.tuple[1] === 'boolean') { + return item.tuple[1] + } else if (Array.isArray(item.tuple[1])) { + return item.tuple[1].map(el => el.tuple) + } else { + return item.tuple[1].tuple + } + } + accum[item.tuple[0]] = getValue() } else if (item.tuple[0] === ':mascots') { accum[item.tuple[0]] = item.tuple[1].reduce((acc, mascot) => { return [...acc, { [mascot.tuple[0]]: { ...mascot.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] @@ -92,6 +100,8 @@ export const parseTuples = (tuples, key) => { accum[item.tuple[0]] = parseStringOrTupleValue(item.tuple[0], item.tuple[1]) } else if (item.tuple[0] === ':args') { accum[item.tuple[0]] = parseNonTuples(item.tuple[0], item.tuple[1]) + } else if (item.tuple[0] === ':ip_whitelist') { + accum[item.tuple[0]] = item.tuple[1].map(ip => typeof ip === 'string' ? ip : ip.tuple.join('.')) } else if (Array.isArray(item.tuple[1]) && (typeof item.tuple[1][0] === 'object' && !Array.isArray(item.tuple[1][0])) && item.tuple[1][0]['tuple']) { accum[item.tuple[0]] = parseTuples(item.tuple[1], item.tuple[0]) @@ -237,8 +247,9 @@ const wrapValues = (settings, currentState) => { return { 'tuple': [setting, wrapValues(value, currentState)] } } else if (prependWithСolon(type, value)) { return { 'tuple': [setting, `:${value}`] } - } else if (type.includes('tuple') && (type.includes('string') || type.includes('atom'))) { - return typeof value === 'string' + } else if (type.includes('tuple') && + (type.includes('string') || type.includes('atom') || type.includes('boolean'))) { + return typeof value === 'string' || typeof value === 'boolean' ? { 'tuple': [setting, value] } : { 'tuple': [setting, { 'tuple': value }] } } else if (type === 'reversed_tuple') { diff --git a/src/views/settings/components/Http.vue b/src/views/settings/components/Http.vue index 7b82537e..8aa8a23b 100644 --- a/src/views/settings/components/Http.vue +++ b/src/views/settings/components/Http.vue @@ -11,14 +11,10 @@ - + - - - -
Submit
@@ -44,12 +40,6 @@ export default { corsPlugData() { return _.get(this.settings.settings, [':cors_plug']) || {} }, - fedSockets() { - return this.settings.description.find(setting => setting.key === ':fed_sockets') - }, - fedSocketsData() { - return _.get(this.settings.settings, [':pleroma', ':fed_sockets']) || {} - }, http() { return this.settings.description.find(setting => setting.key === ':http') }, diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 85e41ef0..e052fefd 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -113,7 +113,7 @@ - + @@ -141,7 +141,7 @@ import { EditableKeywordInput, IconsInput, ImageUploadInput, - LinkFormatterInput, + BooleanCombinedInput, MascotsInput, ProxyUrlInput, PruneInput, @@ -160,7 +160,7 @@ export default { EditableKeywordInput, IconsInput, ImageUploadInput, - LinkFormatterInput, + BooleanCombinedInput, MascotsInput, ProxyUrlInput, PruneInput, @@ -363,6 +363,7 @@ export default { }, renderMultipleSelect(type) { return !this.reducedSelects && Array.isArray(type) && this.setting.key !== ':backends' && this.setting.key !== ':args' && ( + this.setting.key === ':ip_whitelist' || type.includes('module') || (type.includes('list') && type.includes('string')) || (type.includes('list') && type.includes('atom')) || diff --git a/src/views/settings/components/Other.vue b/src/views/settings/components/Other.vue index 0a697138..91a9fe2a 100644 --- a/src/views/settings/components/Other.vue +++ b/src/views/settings/components/Other.vue @@ -2,6 +2,10 @@
+ + + + @@ -94,6 +98,12 @@ export default { modulesData() { return _.get(this.settings.settings, [':pleroma', ':modules']) || {} }, + prometheusMetrics() { + return this.settings.description.find(setting => setting.key === 'Pleroma.Web.Endpoint.MetricsExporter') + }, + prometheusMetricsData() { + return _.get(this.settings.settings, [':prometheus', 'Pleroma.Web.Endpoint.MetricsExporter']) || {} + }, remoteIp() { return this.settings.description.find(setting => setting.key === 'Pleroma.Web.Plugs.RemoteIp') }, diff --git a/src/views/settings/components/inputComponents/LinkFormatterInput.vue b/src/views/settings/components/inputComponents/BooleanCombinedInput.vue similarity index 52% rename from src/views/settings/components/inputComponents/LinkFormatterInput.vue rename to src/views/settings/components/inputComponents/BooleanCombinedInput.vue index 38ec2e50..e47ade3d 100644 --- a/src/views/settings/components/inputComponents/LinkFormatterInput.vue +++ b/src/views/settings/components/inputComponents/BooleanCombinedInput.vue @@ -1,34 +1,46 @@