minor fixes and moves
This commit is contained in:
parent
388ecd9a5e
commit
4a98ec9611
9 changed files with 373 additions and 141 deletions
36
src/components/settings_modal/admin_tabs/links_tab.js
Normal file
36
src/components/settings_modal/admin_tabs/links_tab.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||
import StringSetting from '../helpers/string_setting.vue'
|
||||
import GroupSetting from '../helpers/group_setting.vue'
|
||||
import AttachmentSetting from '../helpers/attachment_setting.vue'
|
||||
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
|
||||
const MediaProxyTab = {
|
||||
provide () {
|
||||
return {
|
||||
defaultDraftMode: true,
|
||||
defaultSource: 'admin'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
BooleanSetting,
|
||||
ChoiceSetting,
|
||||
IntegerSetting,
|
||||
StringSetting,
|
||||
AttachmentSetting,
|
||||
GroupSetting
|
||||
},
|
||||
computed: {
|
||||
mediaProxyEnabled () {
|
||||
return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':enabled']
|
||||
},
|
||||
mediaInvalidationProvider () {
|
||||
return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':invalidation'][':provider']
|
||||
},
|
||||
...SharedComputedObject()
|
||||
}
|
||||
}
|
||||
|
||||
export default MediaProxyTab
|
||||
115
src/components/settings_modal/admin_tabs/links_tab.vue
Normal file
115
src/components/settings_modal/admin_tabs/links_tab.vue
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<template>
|
||||
<div :label="$t('admin_dash.tabs.media_proxy')">
|
||||
<div class="setting-item">
|
||||
<h3>{{ $t('admin_dash.media_proxy.basic') }}</h3>
|
||||
<ul class="setting-list">
|
||||
<li>
|
||||
<BooleanSetting path=":pleroma.:media_proxy.:enabled" />
|
||||
<ul class="setting-list suboptions">
|
||||
<li>
|
||||
<StringSetting
|
||||
path=":pleroma.:media_proxy.:base_url"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<template v-if="mediaProxyEnabled">
|
||||
<h3>{{ $t('admin_dash.media_proxy.invalidation') }}</h3>
|
||||
<ul class="setting-list">
|
||||
<li>
|
||||
<BooleanSetting path=":pleroma.:media_proxy.:invalidation.:enabled" />
|
||||
<ul class="setting-list suboptions">
|
||||
<li>
|
||||
<ChoiceSetting
|
||||
path=":pleroma.:media_proxy.:invalidation.:provider"
|
||||
parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
|
||||
/>
|
||||
</li>
|
||||
<h4>{{ $t('admin_dash.media_proxy.invalidation_settings') }}</h4>
|
||||
<ul class="setting-list suboptions">
|
||||
<template v-if="mediaInvalidationProvider === 'Pleroma.Web.MediaProxy.Invalidation.Http'">
|
||||
<!-- TODO: you know the drill by now - list component -->
|
||||
<li>
|
||||
<!-- choice maybe? -->
|
||||
<StringSetting
|
||||
:path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Http', ':method']"
|
||||
parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
|
||||
/>
|
||||
</li>
|
||||
<!-- TODO: you know the drill by now - list component AGAIN -->
|
||||
</template>
|
||||
<template v-if="mediaInvalidationProvider === 'Pleroma.Web.MediaProxy.Invalidation.Script'">
|
||||
<!-- TODO: you know the drill by now - list component -->
|
||||
<li>
|
||||
<StringSetting
|
||||
:path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Script', ':script_path']"
|
||||
parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<StringSetting
|
||||
:path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Script', ':url_format']"
|
||||
parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
|
||||
/>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>{{ $t('admin_dash.media_proxy.limits') }}</h3>
|
||||
<ul class="setting-list">
|
||||
<li>
|
||||
<IntegerSetting
|
||||
path=":pleroma.:media_proxy.:proxy_opts.:max_body_length"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<IntegerSetting
|
||||
path=":pleroma.:media_proxy.:proxy_opts.:max_read_duration"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<BooleanSetting path=":pleroma.:media_proxy.:proxy_opts.:redirect_on_failure" />
|
||||
</li>
|
||||
</ul>
|
||||
<!-- TODO: add whitelist when we have list component (hehe) -->
|
||||
<h3>{{ $t('admin_dash.media_proxy.thumbnails') }}</h3>
|
||||
<ul class="setting-list">
|
||||
<li>
|
||||
<BooleanSetting path=":pleroma.:media_preview_proxy.:enabled" />
|
||||
<ul class="setting-list suboptions">
|
||||
<li>
|
||||
<IntegerSetting
|
||||
parent-path=":pleroma.:media_preview_proxy.:enabled"
|
||||
path=":pleroma.:media_preview_proxy.:image_quality"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<IntegerSetting
|
||||
parent-path=":pleroma.:media_preview_proxy.:enabled"
|
||||
path=":pleroma.:media_preview_proxy.:min_content_length"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<IntegerSetting
|
||||
parent-path=":pleroma.:media_preview_proxy.:enabled"
|
||||
path=":pleroma.:media_preview_proxy.:thumbnail_max_width"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<IntegerSetting
|
||||
parent-path=":pleroma.:media_preview_proxy.:enabled"
|
||||
path=":pleroma.:media_preview_proxy.:thumbnail_max_height"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./media_proxy_tab.js"></script>
|
||||
|
|
@ -45,6 +45,9 @@ const MailerTab = {
|
|||
adapter () {
|
||||
return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Emails.Mailer'][':adapter']
|
||||
},
|
||||
mailerEnabled () {
|
||||
return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Emails.Mailer'][':enabled']
|
||||
},
|
||||
...SharedComputedObject()
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -4,15 +4,16 @@
|
|||
<h3>{{ $t('admin_dash.mailer.adapter') }}</h3>
|
||||
<ul class="setting-list">
|
||||
<li>
|
||||
<BooleanSetting :path="[':pleroma','Pleroma.Emails.NewUsersDigestEmail',':enabled']" />
|
||||
<BooleanSetting :path="[':pleroma','Pleroma.Emails.Mailer',':enabled']" />
|
||||
</li>
|
||||
<template v-if="mailerEnabled">
|
||||
<li>
|
||||
<ChoiceSetting
|
||||
:path="[':pleroma','Pleroma.Emails.Mailer',':adapter']"
|
||||
:option-label-map="adaptersLabels"
|
||||
/>
|
||||
</li>
|
||||
<h4>{{ $t('admin_dash.mailer.auth') }}</h4>
|
||||
<ul class="setting-list suboptions">
|
||||
<li v-if="adapterHasKey(':api_key')">
|
||||
|
||||
<!-- authentication info -->
|
||||
|
|
@ -139,6 +140,9 @@
|
|||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@
|
|||
<ul class="setting-list">
|
||||
<li>
|
||||
<BooleanSetting path=":pleroma.:media_proxy.:enabled" />
|
||||
<ul class="setting-list suboptions">
|
||||
<ul
|
||||
v-if="mediaProxyEnabled"
|
||||
class="setting-list suboptions"
|
||||
>
|
||||
<li>
|
||||
<StringSetting
|
||||
path=":pleroma.:media_proxy.:base_url"
|
||||
/>
|
||||
<StringSetting path=":pleroma.:media_proxy.:base_url" />
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
|||
21
src/components/settings_modal/helpers/list_setting.js
Normal file
21
src/components/settings_modal/helpers/list_setting.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import Setting from './setting.js'
|
||||
|
||||
export default {
|
||||
...Setting,
|
||||
components: {
|
||||
...Setting.components
|
||||
},
|
||||
props: {
|
||||
...Setting.props
|
||||
},
|
||||
computed: {
|
||||
...Setting.computed
|
||||
},
|
||||
methods: {
|
||||
...Setting.methods,
|
||||
updateValue (e) {
|
||||
console.log(e.target.value)
|
||||
//this.configSink(this.path, parseFloat(e.target.value) + this.stateUnit)
|
||||
}
|
||||
}
|
||||
}
|
||||
45
src/components/settings_modal/helpers/list_setting.vue
Normal file
45
src/components/settings_modal/helpers/list_setting.vue
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<template>
|
||||
<label
|
||||
v-if="matchesExpertLevel"
|
||||
class="StringSetting"
|
||||
>
|
||||
<label
|
||||
:for="path"
|
||||
class="setting-label"
|
||||
:class="{ 'faint': shouldBeDisabled }"
|
||||
>
|
||||
<template v-if="backendDescriptionLabel">
|
||||
{{ backendDescriptionLabel + ' ' }}
|
||||
</template>
|
||||
<template v-else-if="source === 'admin'">
|
||||
MISSING LABEL FOR {{ path }}
|
||||
</template>
|
||||
<slot v-else />
|
||||
</label>
|
||||
{{ ' ' }}
|
||||
<Checkbox
|
||||
v-for="option in value"
|
||||
:model-value="value"
|
||||
:disabled="shouldBeDisabled"
|
||||
@update:model-value="update"
|
||||
>
|
||||
{{ value }}
|
||||
</Checkbox>
|
||||
{{ ' ' }}
|
||||
<ModifiedIndicator
|
||||
:changed="isChanged"
|
||||
:onclick="reset"
|
||||
/>
|
||||
<ProfileSettingIndicator :is-profile="isProfileSetting" />
|
||||
<DraftButtons />
|
||||
<p
|
||||
v-if="backendDescriptionDescription"
|
||||
class="setting-description"
|
||||
:class="{ 'faint': shouldBeDisabled }"
|
||||
>
|
||||
{{ backendDescriptionDescription + ' ' }}
|
||||
</p>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<script src="./string_setting.js"></script>
|
||||
|
|
@ -77,7 +77,7 @@ export default {
|
|||
},
|
||||
created () {
|
||||
if (this.realDraftMode && (this.realSource !== 'admin' || this.path == null)) {
|
||||
this.draft = this.state
|
||||
this.draft = cloneDeep(this.state)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -158,7 +158,14 @@ export default {
|
|||
if (this.path == null) {
|
||||
return this.disabled
|
||||
}
|
||||
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
|
||||
let parentValue = null
|
||||
if (this.parentPath !== undefined && this.realSource === 'admin') {
|
||||
if (this.realDraftMode) {
|
||||
parentValue = get(this.$store.state.adminSettings.draft, this.parentPath)
|
||||
} else {
|
||||
parentValue = get(this.configSource, this.parentPath)
|
||||
}
|
||||
}
|
||||
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
|
||||
},
|
||||
configSource () {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ const adminSettingsStorage = {
|
|||
}
|
||||
set(config, path, convert(c.value))
|
||||
})
|
||||
console.log('CONFIG', config)
|
||||
console.log('CONFIG', JSON.parse(JSON.stringify(config)))
|
||||
commit('updateAdminSettings', { config, modifiedPaths })
|
||||
commit('resetAdminDraft')
|
||||
},
|
||||
|
|
@ -208,7 +208,7 @@ const adminSettingsStorage = {
|
|||
.then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
|
||||
},
|
||||
resetAdminSetting ({ rootState, state, dispatch }, { path }) {
|
||||
const [group, key, subkey] = path.split(/\./g)
|
||||
const [group, key, subkey] = Array.isArray(path) ? path : path.split(/\./g)
|
||||
|
||||
state.modifiedPaths.delete(path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue