2018-05-17 21:40:41 +00:00
|
|
|
<template>
|
2018-11-19 22:33:22 +00:00
|
|
|
<main class="main pusher" v-title="labels.settings">
|
2018-05-17 21:40:41 +00:00
|
|
|
<div class="ui vertical stripe segment">
|
|
|
|
<div class="ui text container">
|
|
|
|
<div :class="['ui', {'loading': isLoading}, 'form']"></div>
|
|
|
|
<div id="settings-grid" v-if="settingsData" class="ui grid">
|
|
|
|
<div class="twelve wide stretched column">
|
|
|
|
<settings-group
|
|
|
|
:settings-data="settingsData"
|
|
|
|
:group="group"
|
|
|
|
:key="group.title"
|
|
|
|
v-for="group in groups" />
|
|
|
|
</div>
|
|
|
|
<div class="four wide column">
|
|
|
|
<div class="ui sticky vertical secondary menu">
|
2019-03-08 11:37:02 +00:00
|
|
|
<div class="header item"><translate translate-context="Content/Admin/Menu.Title">Sections</translate></div>
|
2018-05-17 21:40:41 +00:00
|
|
|
<a :class="['menu', {active: group.id === current}, 'item']"
|
|
|
|
@click.prevent="scrollTo(group.id)"
|
|
|
|
:href="'#' + group.id"
|
|
|
|
v-for="group in groups">{{ group.label }}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-11-19 22:33:22 +00:00
|
|
|
</main>
|
2018-05-17 21:40:41 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-11-19 22:33:22 +00:00
|
|
|
import axios from "axios"
|
|
|
|
import $ from "jquery"
|
2018-05-17 21:40:41 +00:00
|
|
|
|
2018-11-19 22:33:22 +00:00
|
|
|
import SettingsGroup from "@/components/admin/SettingsGroup"
|
2018-05-17 21:40:41 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
SettingsGroup
|
|
|
|
},
|
2018-11-19 22:33:22 +00:00
|
|
|
data() {
|
2018-05-17 21:40:41 +00:00
|
|
|
return {
|
|
|
|
isLoading: false,
|
|
|
|
settingsData: null,
|
|
|
|
current: null
|
|
|
|
}
|
|
|
|
},
|
2018-11-19 22:33:22 +00:00
|
|
|
created() {
|
2018-05-17 21:40:41 +00:00
|
|
|
let self = this
|
|
|
|
this.fetchSettings().then(r => {
|
|
|
|
self.$nextTick(() => {
|
|
|
|
if (self.$store.state.route.hash) {
|
|
|
|
self.scrollTo(self.$store.state.route.hash.substr(1))
|
|
|
|
}
|
2018-11-19 22:33:22 +00:00
|
|
|
$("select.dropdown").dropdown()
|
2018-05-17 21:40:41 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
2018-11-19 22:33:22 +00:00
|
|
|
scrollTo(id) {
|
2018-05-17 21:40:41 +00:00
|
|
|
this.current = id
|
|
|
|
document.getElementById(id).scrollIntoView()
|
|
|
|
},
|
2018-11-19 22:33:22 +00:00
|
|
|
fetchSettings() {
|
2018-05-17 21:40:41 +00:00
|
|
|
let self = this
|
|
|
|
self.isLoading = true
|
2018-11-19 22:33:22 +00:00
|
|
|
return axios.get("instance/admin/settings/").then(response => {
|
2018-05-17 21:40:41 +00:00
|
|
|
self.settingsData = response.data
|
|
|
|
self.isLoading = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2018-11-19 22:33:22 +00:00
|
|
|
labels() {
|
2018-07-01 19:50:50 +00:00
|
|
|
return {
|
2019-02-09 15:52:47 +00:00
|
|
|
settings: this.$pgettext('Head/Admin/Title', 'Instance settings')
|
2018-07-01 19:50:50 +00:00
|
|
|
}
|
|
|
|
},
|
2018-11-19 22:33:22 +00:00
|
|
|
groups() {
|
2018-06-30 18:32:05 +00:00
|
|
|
// somehow, extraction fails if in the return block directly
|
2019-02-09 15:52:47 +00:00
|
|
|
let instanceLabel = this.$pgettext('Content/Admin/Menu','Instance information')
|
2019-03-18 09:07:58 +00:00
|
|
|
let usersLabel = this.$pgettext('*/*/*/Noun', 'Users')
|
|
|
|
let musicLabel = this.$pgettext('*/*/*/Noun', 'Music')
|
|
|
|
let playlistsLabel = this.$pgettext('*/*/*', 'Playlists')
|
2019-02-09 15:52:47 +00:00
|
|
|
let federationLabel = this.$pgettext('Content/Admin/Menu', 'Federation')
|
2019-06-26 08:22:53 +00:00
|
|
|
let moderationLabel = this.$pgettext('Content/Admin/Menu', 'Moderation')
|
2019-02-09 15:52:47 +00:00
|
|
|
let subsonicLabel = this.$pgettext('Content/Admin/Menu', 'Subsonic')
|
|
|
|
let statisticsLabel = this.$pgettext('Content/Admin/Menu', 'Statistics')
|
2019-07-03 09:06:13 +00:00
|
|
|
let uiLabel = this.$pgettext('Content/Admin/Menu', 'User Interface')
|
2019-02-09 15:52:47 +00:00
|
|
|
let errorLabel = this.$pgettext('Content/Admin/Menu', 'Error reporting')
|
2018-05-17 21:40:41 +00:00
|
|
|
return [
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: instanceLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "instance",
|
2018-05-17 21:40:41 +00:00
|
|
|
settings: [
|
2018-11-19 22:33:22 +00:00
|
|
|
"instance__name",
|
|
|
|
"instance__short_description",
|
2019-09-16 09:33:33 +00:00
|
|
|
"instance__long_description",
|
|
|
|
"instance__terms",
|
2019-09-17 09:03:32 +00:00
|
|
|
"instance__banner",
|
2018-05-17 21:40:41 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: usersLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "users",
|
2018-05-17 21:40:41 +00:00
|
|
|
settings: [
|
2018-11-19 22:33:22 +00:00
|
|
|
"users__registration_enabled",
|
|
|
|
"common__api_authentication_required",
|
|
|
|
"users__default_permissions",
|
|
|
|
"users__upload_quota"
|
2018-05-17 21:40:41 +00:00
|
|
|
]
|
|
|
|
},
|
2018-10-26 13:37:43 +00:00
|
|
|
{
|
|
|
|
label: musicLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "music",
|
2018-10-26 13:37:43 +00:00
|
|
|
settings: [
|
2018-11-19 22:33:22 +00:00
|
|
|
"music__transcoding_enabled",
|
|
|
|
"music__transcoding_cache_duration"
|
2018-10-26 13:37:43 +00:00
|
|
|
]
|
|
|
|
},
|
2018-05-17 21:40:41 +00:00
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: playlistsLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "playlists",
|
|
|
|
settings: ["playlists__max_tracks"]
|
2018-05-17 21:40:41 +00:00
|
|
|
},
|
2019-06-26 08:22:53 +00:00
|
|
|
{
|
|
|
|
label: moderationLabel,
|
|
|
|
id: "moderation",
|
|
|
|
settings: [
|
|
|
|
"moderation__allow_list_enabled",
|
|
|
|
"moderation__allow_list_public",
|
2019-09-06 13:10:16 +00:00
|
|
|
"moderation__unauthenticated_report_types",
|
2019-06-26 08:22:53 +00:00
|
|
|
]
|
|
|
|
},
|
2018-05-17 21:40:41 +00:00
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: federationLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "federation",
|
2018-05-17 21:40:41 +00:00
|
|
|
settings: [
|
2018-11-19 22:33:22 +00:00
|
|
|
"federation__enabled",
|
|
|
|
"federation__music_needs_approval",
|
|
|
|
"federation__collection_page_size",
|
|
|
|
"federation__music_cache_duration",
|
|
|
|
"federation__actor_fetch_delay"
|
2018-05-17 21:40:41 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: subsonicLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "subsonic",
|
|
|
|
settings: ["subsonic__enabled"]
|
2018-05-17 21:40:41 +00:00
|
|
|
},
|
2019-07-03 09:06:13 +00:00
|
|
|
{
|
|
|
|
label: uiLabel,
|
|
|
|
id: "ui",
|
|
|
|
settings: ["ui__custom_css"]
|
|
|
|
},
|
2018-05-17 21:40:41 +00:00
|
|
|
{
|
2018-06-30 14:27:26 +00:00
|
|
|
label: statisticsLabel,
|
2018-11-19 22:33:22 +00:00
|
|
|
id: "statistics",
|
2018-05-17 21:40:41 +00:00
|
|
|
settings: [
|
2018-11-19 22:33:22 +00:00
|
|
|
"instance__nodeinfo_enabled",
|
|
|
|
"instance__nodeinfo_stats_enabled",
|
|
|
|
"instance__nodeinfo_private"
|
2018-05-17 21:40:41 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2018-11-19 22:33:22 +00:00
|
|
|
settingsData() {
|
2018-05-17 21:40:41 +00:00
|
|
|
let self = this
|
|
|
|
this.$nextTick(() => {
|
2018-11-19 22:33:22 +00:00
|
|
|
$(self.$el)
|
|
|
|
.find(".sticky")
|
|
|
|
.sticky({ context: "#settings-grid" })
|
2018-05-17 21:40:41 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|