Merge branch 'feature/media-preview-proxy' into 'master'
Ability to configure Media Preview Proxy settings See merge request pleroma/admin-fe!183
This commit is contained in:
commit
c18f167a12
8 changed files with 73 additions and 11 deletions
11
CHANGELOG.md
11
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
@change="update($event, settingGroup.group, settingGroup.key, settingParent, setting.key, setting.type, nested)"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="setting.type === 'string' || (setting.type.includes('string') && setting.type.includes('atom'))"
|
||||
v-else-if="setting.type === 'string' ||
|
||||
(Array.isArray(setting.type) && setting.type.includes('string') && setting.type.includes('atom'))"
|
||||
:value="inputValue"
|
||||
:placeholder="setting.suggestions ? setting.suggestions[0] : null"
|
||||
:data-search="setting.key || setting.group"
|
||||
|
@ -358,7 +359,10 @@ export default {
|
|||
)
|
||||
},
|
||||
renderSingleSelect(type) {
|
||||
return !this.reducedSelects && (type === 'module' || (type.includes('atom') && type.includes('dropdown')))
|
||||
return !this.reducedSelects && (
|
||||
type === 'module' ||
|
||||
(Array.isArray(type) && type.includes('atom') && type.includes('dropdown'))
|
||||
)
|
||||
},
|
||||
senderInput({ key, type }) {
|
||||
return Array.isArray(type) && type.includes('string') && type.includes('tuple') && key === ':sender'
|
||||
|
|
|
@ -43,10 +43,10 @@ export default {
|
|||
'settings'
|
||||
]),
|
||||
activityExpiration() {
|
||||
return this.settings.description.find(setting => 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')
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
<setting :setting-group="mediaProxy" :data="mediaProxyData"/>
|
||||
</el-form>
|
||||
<el-divider v-if="mediaProxy" class="divider thick-line"/>
|
||||
<el-form v-if="!loading" :model="mediaPreviewProxyData" :label-position="labelPosition" :label-width="labelWidth">
|
||||
<setting :setting-group="mediaPreviewProxy" :data="mediaPreviewProxyData"/>
|
||||
</el-form>
|
||||
<el-divider v-if="mediaPreviewProxy" class="divider thick-line"/>
|
||||
<el-form v-if="!loading" :model="httpInvalidationData" :label-position="labelPosition" :label-width="labelWidth">
|
||||
<setting :setting-group="httpInvalidation" :data="httpInvalidationData"/>
|
||||
</el-form>
|
||||
|
@ -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')
|
||||
},
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']}}
|
||||
|
|
Loading…
Reference in a new issue