diff --git a/CHANGELOG.md b/CHANGELOG.md index 08017fe7..ef4d1a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [2.2] - 2020-11-18 + +### Added + +- Ability to configure Media Preview Proxy settings on MediaProxy tab + +### Fixed + +- Update keys for PurgeExpiredActivity and RemoteIp settings +- Fix wrapping `:icons` setting and parsing tuples in settings with key `:headers` + ## [2.1] - 2020-08-26 ### Added diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index 3ca63ca2..58e0e284 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -66,7 +66,11 @@ export const parseTuples = (tuples, key) => { return [...acc, { [mascot.tuple[0]]: { ...mascot.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] }, []) } else if (Array.isArray(item.tuple[1]) && - (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries' || item.tuple[0] === ':headers' || item.tuple[0] === ':crontab')) { + (item.tuple[0] === ':groups' || + item.tuple[0] === ':replace' || + item.tuple[0] === ':retries' || + (item.tuple[0] === ':headers' && key === 'Pleroma.Web.MediaProxy.Invalidation.Http') || + item.tuple[0] === ':crontab')) { if (item.tuple[0] === ':crontab') { accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => { return [...acc, { [group.tuple[1]]: { value: group.tuple[0], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] @@ -245,7 +249,7 @@ const wrapValues = (settings, currentState) => { return acc }, {}) return { 'tuple': [setting, { ...currentState[setting], ...mapValue }] } - } else if (type.includes('map')) { + } else if (type.includes('map') && !type.includes('list')) { const mapValue = Object.keys(value).reduce((acc, key) => { acc[key] = value[key][1] return acc diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index b412c1e4..ad3d7fe1 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -42,7 +42,8 @@ @change="update($event, settingGroup.group, settingGroup.key, settingParent, setting.key, setting.type, nested)" /> setting.key === 'Pleroma.ActivityExpiration') + return this.settings.description.find(setting => setting.key === 'Pleroma.Workers.PurgeExpiredActivity') }, activityExpirationData() { - return _.get(this.settings.settings, [':pleroma', 'Pleroma.ActivityExpiration']) || {} + return _.get(this.settings.settings, [':pleroma', 'Pleroma.Workers.PurgeExpiredActivity']) || {} }, connectionsPools() { return this.settings.description.find(setting => setting.key === ':connections_pool') diff --git a/src/views/settings/components/MediaProxy.vue b/src/views/settings/components/MediaProxy.vue index d3fa619d..701a28ff 100644 --- a/src/views/settings/components/MediaProxy.vue +++ b/src/views/settings/components/MediaProxy.vue @@ -4,6 +4,10 @@ + + + + @@ -60,6 +64,12 @@ export default { loading() { return this.settings.loading }, + mediaPreviewProxy() { + return this.settings.description.find(setting => setting.key === ':media_preview_proxy') + }, + mediaPreviewProxyData() { + return _.get(this.settings.settings, [':pleroma', ':media_preview_proxy']) || {} + }, mediaProxy() { return this.settings.description.find(setting => setting.key === ':media_proxy') }, diff --git a/src/views/settings/components/Other.vue b/src/views/settings/components/Other.vue index b1ee7369..cc8fb841 100644 --- a/src/views/settings/components/Other.vue +++ b/src/views/settings/components/Other.vue @@ -77,10 +77,10 @@ export default { return _.get(this.settings.settings, [':pleroma', ':modules']) || {} }, remoteIp() { - return this.settings.description.find(setting => setting.key === 'Pleroma.Plugs.RemoteIp') + return this.settings.description.find(setting => setting.key === 'Pleroma.Web.Plugs.RemoteIp') }, remoteIpData() { - return _.get(this.settings.settings, [':pleroma', 'Pleroma.Plugs.RemoteIp']) || {} + return _.get(this.settings.settings, [':pleroma', 'Pleroma.Web.Plugs.RemoteIp']) || {} } }, methods: { diff --git a/src/views/settings/components/tabs.js b/src/views/settings/components/tabs.js index 011a16b8..601c0052 100644 --- a/src/views/settings/components/tabs.js +++ b/src/views/settings/components/tabs.js @@ -34,7 +34,7 @@ export const tabs = description => { }, 'job-queue': { label: 'settings.jobQueue', - settings: ['Pleroma.ActivityExpiration', ':connections_pool', ':hackney_pools', 'Oban', ':pools', ':workers'] + settings: ['Pleroma.Workers.PurgeExpiredActivity', ':connections_pool', ':hackney_pools', 'Oban', ':pools', ':workers'] }, 'link-formatter': { label: 'settings.linkFormatter', @@ -50,7 +50,7 @@ export const tabs = description => { }, 'media-proxy': { label: 'settings.mediaProxy', - settings: [':media_proxy', 'Pleroma.Web.MediaProxy.Invalidation.Http', 'Pleroma.Web.MediaProxy.Invalidation.Script'] + settings: [':media_proxy', ':media_preview_proxy', 'Pleroma.Web.MediaProxy.Invalidation.Http', 'Pleroma.Web.MediaProxy.Invalidation.Script'] }, 'metadata': { label: 'settings.metadata', @@ -78,7 +78,7 @@ export const tabs = description => { }, 'other': { label: 'settings.other', - settings: [':mime', 'Pleroma.Plugs.RemoteIp', ':modules', 'Pleroma.Web.ApiSpec.CastAndValidate'] + settings: [':mime', 'Pleroma.Web.Plugs.RemoteIp', ':modules', 'Pleroma.Web.ApiSpec.CastAndValidate'] } } } diff --git a/test/modules/normalizers/wrapUpdatedSettings.test.js b/test/modules/normalizers/wrapUpdatedSettings.test.js index 78f8ee6e..7e5dafab 100644 --- a/test/modules/normalizers/wrapUpdatedSettings.test.js +++ b/test/modules/normalizers/wrapUpdatedSettings.test.js @@ -340,6 +340,39 @@ describe('Wrap settings', () => { expect(_.isEqual(result1, expectedResult1)).toBeTruthy() expect(_.isEqual(result2, expectedResult2)).toBeTruthy() }) + + it('wraps settings with type [`list`, `map`]', () => { + const settings = { ':manifest': { ':icons': [['map', 'list'], [ + { ':src': '/static/logo.png', ':type': 'image/png' }, + { ':src': '/static/icon.png', ':type': 'image/png' } + ]]}} + + const state = { ':pleroma': { ':manifest': { + ':background_color': '#191b22', + ':theme_color': '#282c37', + ':icons': [ + [ + { 'id': 'f21318c4', 'key': ':src', 'value': '/static/logo.png' }, + { 'id': 'f4b87549', 'key': ':type', 'value': 'image/png' } + ], [ + { 'id': 'f31d351e', 'key': ':src', 'value': '/static/icon.png' }, + { 'id': 'f1455852', 'key': ':type', 'value': 'image/png' } + ] + ] + }}} + + const result = wrapUpdatedSettings(':pleroma', settings, state) + const expectedResult = [{ + group: ':pleroma', + key: ':manifest', + value: [{ tuple: [':icons', [ + { ':src': '/static/logo.png', ':type': 'image/png' }, + { ':src': '/static/icon.png', ':type': 'image/png' } + ]]}] + }] + + expect(_.isEqual(result, expectedResult)).toBeTruthy() + }) it('wraps IP setting', () => { const settings = { ':gopher': { ':ip': ['tuple', '127.0.0.1']}}