2019-08-09 16:45:25 +00:00
|
|
|
<template>
|
2020-04-17 22:27:00 +00:00
|
|
|
<div :class="rebootIsSidebarOpen" class="settings-container">
|
|
|
|
<div class="reboot-button-container">
|
|
|
|
<reboot-button/>
|
|
|
|
</div>
|
2020-02-14 15:52:33 +00:00
|
|
|
<div v-if="isDesktop">
|
2020-03-24 16:14:36 +00:00
|
|
|
<div :class="isSidebarOpen" class="settings-header-container">
|
2020-02-14 15:52:33 +00:00
|
|
|
<h1 class="settings-header">{{ $t('settings.settings') }}</h1>
|
2020-04-17 22:27:00 +00:00
|
|
|
<div class="docs-search-container">
|
2020-02-18 19:20:11 +00:00
|
|
|
<el-link
|
|
|
|
:underline="false"
|
|
|
|
href="https://docs-develop.pleroma.social/backend/administration/CLI_tasks/config/"
|
|
|
|
target="_blank">
|
|
|
|
<el-button class="settings-docs-button">
|
|
|
|
<span>
|
|
|
|
<i class="el-icon-document"/>
|
|
|
|
{{ $t('settings.seeDocs') }}
|
|
|
|
</span>
|
|
|
|
</el-button>
|
|
|
|
</el-link>
|
2020-02-23 21:17:24 +00:00
|
|
|
<el-autocomplete
|
2020-02-24 21:24:46 +00:00
|
|
|
v-model="searchQuery"
|
2020-02-23 21:17:24 +00:00
|
|
|
:fetch-suggestions="querySearch"
|
|
|
|
:trigger-on-focus="false"
|
2020-03-14 22:31:47 +00:00
|
|
|
clearable
|
2020-02-23 21:17:24 +00:00
|
|
|
placeholder="Search"
|
|
|
|
prefix-icon="el-icon-search"
|
2020-02-25 15:57:38 +00:00
|
|
|
class="settings-search-input"
|
|
|
|
@select="handleSearchSelect"/>
|
2020-02-18 19:20:11 +00:00
|
|
|
</div>
|
2020-02-14 15:52:33 +00:00
|
|
|
</div>
|
|
|
|
<el-tabs v-model="activeTab" tab-position="left">
|
2020-02-25 16:59:47 +00:00
|
|
|
<el-tab-pane
|
|
|
|
v-for="(value, componentName) in tabs"
|
|
|
|
:label="$t(value.label)"
|
2020-05-14 22:24:12 +00:00
|
|
|
:disabled="configDisabled || settingsCantBeChanged(value.settings)"
|
2020-02-25 16:59:47 +00:00
|
|
|
:key="componentName"
|
|
|
|
:name="componentName"
|
|
|
|
lazy>
|
|
|
|
<component :is="componentName"/>
|
2020-02-14 15:52:33 +00:00
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
2020-02-05 17:30:19 +00:00
|
|
|
</div>
|
2020-02-17 14:27:07 +00:00
|
|
|
<div v-if="isMobile || isTablet">
|
2020-03-24 16:14:36 +00:00
|
|
|
<div :class="isSidebarOpen" class="settings-header-container">
|
2020-02-18 19:20:11 +00:00
|
|
|
<h1 class="settings-header">{{ $t('settings.settings') }}</h1>
|
|
|
|
</div>
|
|
|
|
<div class="nav-container">
|
2020-02-14 15:52:33 +00:00
|
|
|
<el-select v-model="activeTab" class="settings-menu" placeholder="Select">
|
|
|
|
<el-option
|
|
|
|
v-for="item in options"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
:disabled="configDisabled"/>
|
|
|
|
</el-select>
|
|
|
|
<el-link
|
|
|
|
:underline="false"
|
|
|
|
href="https://docs-develop.pleroma.social/backend/administration/CLI_tasks/config/"
|
|
|
|
target="_blank">
|
|
|
|
<el-button class="settings-docs-button">
|
|
|
|
<span>
|
|
|
|
<i class="el-icon-document"/>
|
|
|
|
{{ $t('settings.seeDocs') }}
|
|
|
|
</span>
|
|
|
|
</el-button>
|
|
|
|
</el-link>
|
|
|
|
</div>
|
2020-02-25 16:59:47 +00:00
|
|
|
<div class="settings-search-input-container"/>
|
2020-02-06 18:01:54 +00:00
|
|
|
<activity-pub v-if="activeTab === 'activityPub'"/>
|
|
|
|
<authentication v-if="activeTab === 'auth'"/>
|
2020-07-24 20:29:12 +00:00
|
|
|
<link-formatter v-if="activeTab === 'linkFormatter'"/>
|
2020-02-06 18:01:54 +00:00
|
|
|
<esshd v-if="activeTab === 'esshd'"/>
|
|
|
|
<captcha v-if="activeTab === 'captcha'"/>
|
|
|
|
<frontend v-if="activeTab === 'frontend'"/>
|
|
|
|
<gopher v-if="activeTab === 'gopher'"/>
|
|
|
|
<http v-if="activeTab === 'http'"/>
|
|
|
|
<instance v-if="activeTab === 'instance'"/>
|
|
|
|
<job-queue v-if="activeTab === 'jobQueue'"/>
|
|
|
|
<logger v-if="activeTab === 'logger'"/>
|
|
|
|
<mailer v-if="activeTab === 'mailer'"/>
|
|
|
|
<media-proxy v-if="activeTab === 'mediaProxy'"/>
|
|
|
|
<metadata v-if="activeTab === 'metadata'"/>
|
|
|
|
<mrf v-if="activeTab === 'mrf'"/>
|
|
|
|
<rate-limiters v-if="activeTab === 'rateLimiters'"/>
|
|
|
|
<relays v-if="activeTab === 'relays'"/>
|
|
|
|
<web-push v-if="activeTab === 'webPush'"/>
|
|
|
|
<upload v-if="activeTab === 'upload'"/>
|
|
|
|
<other v-if="activeTab === 'other'"/>
|
|
|
|
</div>
|
2019-08-09 16:45:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-02-06 16:53:30 +00:00
|
|
|
import i18n from '@/lang'
|
2020-02-25 16:59:47 +00:00
|
|
|
import { tabs } from './components/tabs'
|
2020-01-29 16:58:00 +00:00
|
|
|
import {
|
|
|
|
ActivityPub,
|
|
|
|
Authentication,
|
|
|
|
Captcha,
|
|
|
|
Esshd,
|
|
|
|
Frontend,
|
|
|
|
Gopher,
|
|
|
|
Http,
|
|
|
|
Instance,
|
|
|
|
JobQueue,
|
2020-07-24 20:29:12 +00:00
|
|
|
LinkFormatter,
|
2020-01-29 16:58:00 +00:00
|
|
|
Logger,
|
|
|
|
Mailer,
|
|
|
|
MediaProxy,
|
|
|
|
Metadata,
|
|
|
|
Mrf,
|
|
|
|
Other,
|
|
|
|
RateLimiters,
|
|
|
|
Relays,
|
|
|
|
Upload,
|
|
|
|
WebPush
|
|
|
|
} from './components'
|
2020-04-17 22:27:00 +00:00
|
|
|
import RebootButton from '@/components/RebootButton'
|
2019-08-09 16:45:25 +00:00
|
|
|
|
|
|
|
export default {
|
2020-01-29 16:58:00 +00:00
|
|
|
components: {
|
|
|
|
ActivityPub,
|
|
|
|
Authentication,
|
|
|
|
Captcha,
|
|
|
|
Esshd,
|
|
|
|
Frontend,
|
|
|
|
Gopher,
|
|
|
|
Http,
|
|
|
|
Instance,
|
|
|
|
JobQueue,
|
2020-07-24 20:29:12 +00:00
|
|
|
LinkFormatter,
|
2020-01-29 16:58:00 +00:00
|
|
|
Logger,
|
|
|
|
Mailer,
|
|
|
|
MediaProxy,
|
|
|
|
Metadata,
|
|
|
|
Mrf,
|
|
|
|
Other,
|
|
|
|
RateLimiters,
|
|
|
|
Relays,
|
2020-04-17 22:27:00 +00:00
|
|
|
RebootButton,
|
2020-01-29 16:58:00 +00:00
|
|
|
Upload,
|
|
|
|
WebPush
|
|
|
|
},
|
2020-02-06 16:53:30 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
options: [
|
|
|
|
{ value: 'activityPub', label: i18n.t('settings.activityPub') },
|
|
|
|
{ value: 'auth', label: i18n.t('settings.auth') },
|
2020-07-24 20:29:12 +00:00
|
|
|
{ value: 'linkFormatter', label: i18n.t('settings.linkFormatter') },
|
2020-02-06 16:53:30 +00:00
|
|
|
{ value: 'esshd', label: i18n.t('settings.esshd') },
|
|
|
|
{ value: 'captcha', label: i18n.t('settings.captcha') },
|
|
|
|
{ value: 'frontend', label: i18n.t('settings.frontend') },
|
|
|
|
{ value: 'gopher', label: i18n.t('settings.gopher') },
|
|
|
|
{ value: 'http', label: i18n.t('settings.http') },
|
|
|
|
{ value: 'instance', label: i18n.t('settings.instance') },
|
|
|
|
{ value: 'jobQueue', label: i18n.t('settings.jobQueue') },
|
|
|
|
{ value: 'logger', label: i18n.t('settings.logger') },
|
|
|
|
{ value: 'mailer', label: i18n.t('settings.mailer') },
|
|
|
|
{ value: 'mediaProxy', label: i18n.t('settings.mediaProxy') },
|
|
|
|
{ value: 'metadata', label: i18n.t('settings.metadata') },
|
|
|
|
{ value: 'mrf', label: i18n.t('settings.mrf') },
|
|
|
|
{ value: 'rateLimiters', label: i18n.t('settings.rateLimiters') },
|
|
|
|
{ value: 'relays', label: i18n.t('settings.relays') },
|
|
|
|
{ value: 'webPush', label: i18n.t('settings.webPush') },
|
|
|
|
{ value: 'upload', label: i18n.t('settings.upload') },
|
|
|
|
{ value: 'other', label: i18n.t('settings.other') }
|
2020-02-24 21:24:46 +00:00
|
|
|
],
|
|
|
|
searchQuery: ''
|
2020-02-06 16:53:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-08-09 16:45:25 +00:00
|
|
|
computed: {
|
2020-01-30 12:40:39 +00:00
|
|
|
activeTab: {
|
|
|
|
get() {
|
|
|
|
return this.$store.state.settings.activeTab
|
|
|
|
},
|
|
|
|
set(tab) {
|
|
|
|
this.$store.dispatch('SetActiveTab', tab)
|
|
|
|
}
|
|
|
|
},
|
2020-02-01 13:08:10 +00:00
|
|
|
configDisabled() {
|
2020-01-30 12:40:39 +00:00
|
|
|
return this.$store.state.settings.configDisabled
|
|
|
|
},
|
2020-02-06 16:53:30 +00:00
|
|
|
isDesktop() {
|
|
|
|
return this.$store.state.app.device === 'desktop'
|
|
|
|
},
|
2019-08-09 16:45:25 +00:00
|
|
|
isMobile() {
|
|
|
|
return this.$store.state.app.device === 'mobile'
|
2020-02-17 14:27:07 +00:00
|
|
|
},
|
2020-03-24 16:14:36 +00:00
|
|
|
isSidebarOpen() {
|
|
|
|
return this.$store.state.app.sidebar.opened ? 'header-sidebar-opened' : 'header-sidebar-closed'
|
|
|
|
},
|
2020-02-17 14:27:07 +00:00
|
|
|
isTablet() {
|
|
|
|
return this.$store.state.app.device === 'tablet'
|
2020-02-18 19:20:11 +00:00
|
|
|
},
|
2020-04-17 22:27:00 +00:00
|
|
|
rebootIsSidebarOpen() {
|
|
|
|
return this.$store.state.app.sidebar.opened ? 'reboot-sidebar-opened' : 'reboot-sidebar-closed'
|
2020-02-24 21:24:46 +00:00
|
|
|
},
|
|
|
|
searchData() {
|
|
|
|
return this.$store.state.settings.searchData
|
2020-02-25 16:59:47 +00:00
|
|
|
},
|
|
|
|
tabs() {
|
|
|
|
return tabs
|
2019-08-09 16:45:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted: function() {
|
2020-04-17 22:27:00 +00:00
|
|
|
this.$store.dispatch('GetNodeInfo')
|
|
|
|
this.$store.dispatch('NeedReboot')
|
2019-08-09 16:45:25 +00:00
|
|
|
this.$store.dispatch('FetchSettings')
|
2020-02-18 20:08:07 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2020-03-12 20:48:50 +00:00
|
|
|
async handleSearchSelect(selectedValue) {
|
2020-03-09 21:43:32 +00:00
|
|
|
const tab = Object.keys(this.tabs).find(tab => {
|
2020-03-15 19:44:36 +00:00
|
|
|
return this.tabs[tab].settings.includes(selectedValue.group === ':pleroma' ? selectedValue.key : selectedValue.group)
|
2020-03-09 21:43:32 +00:00
|
|
|
})
|
2020-03-12 20:48:50 +00:00
|
|
|
await this.$store.dispatch('SetActiveTab', tab)
|
|
|
|
const selectedSetting = document.querySelector(`[data-search="${selectedValue.key}"]`)
|
2020-03-14 22:31:47 +00:00
|
|
|
if (selectedSetting) {
|
|
|
|
selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' })
|
|
|
|
}
|
2020-02-25 15:57:38 +00:00
|
|
|
},
|
2020-02-24 21:24:46 +00:00
|
|
|
querySearch(queryString, cb) {
|
2020-03-09 19:09:32 +00:00
|
|
|
const results = this.searchData.filter(searchObj => searchObj.search.find(el => el.includes(queryString.toLowerCase())))
|
|
|
|
.map(searchObj => {
|
2020-03-15 19:44:36 +00:00
|
|
|
return searchObj.groupKey === ':opts'
|
|
|
|
? { value: `${searchObj.label} in Auto Linker`, group: searchObj.groupKey, key: searchObj.key }
|
|
|
|
: { value: `${searchObj.label} in ${searchObj.groupLabel}`, group: searchObj.groupKey, key: searchObj.key }
|
2020-03-09 19:09:32 +00:00
|
|
|
})
|
2020-02-24 21:24:46 +00:00
|
|
|
cb(results)
|
2020-05-14 22:24:12 +00:00
|
|
|
},
|
|
|
|
settingsCantBeChanged(settings) {
|
2020-05-14 23:48:46 +00:00
|
|
|
const existingSettings = settings.filter(setting => {
|
2020-05-16 17:42:50 +00:00
|
|
|
if ([':esshd', ':cors_plug', ':quack', ':logger', ':swoosh', ':mime'].includes(setting)) {
|
2020-05-14 23:48:46 +00:00
|
|
|
return this.$store.state.settings.description.findIndex(el => el.group === setting) !== -1
|
|
|
|
} else if (setting === 'Pleroma.Web.Auth.Authenticator' || setting === ':admin_token') {
|
|
|
|
return this.$store.state.settings.description.findIndex(el => el.children[0].key === setting) !== -1
|
|
|
|
} else if (setting === 'relays') {
|
|
|
|
return [setting]
|
|
|
|
} else {
|
|
|
|
return this.$store.state.settings.description.findIndex(el => el.key === setting) !== -1
|
|
|
|
}
|
|
|
|
})
|
2020-05-14 22:24:12 +00:00
|
|
|
return existingSettings.length === 0
|
2020-02-18 20:08:07 +00:00
|
|
|
}
|
2019-08-09 16:45:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-04-17 22:27:00 +00:00
|
|
|
<style rel='stylesheet/scss' lang='scss' scoped>
|
2020-02-17 22:18:43 +00:00
|
|
|
@import './styles/main';
|
|
|
|
@include settings
|
2019-08-09 16:45:25 +00:00
|
|
|
</style>
|