A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: server config should be on its own page
aminnausinc5a7a1d37f3c
diff --git a/resources/js/components/settings/SettingsFormLabel.vue b/resources/js/components/config/ConfigFormLabel.vuesimilarity index 100%rename from resources/js/components/settings/SettingsFormLabel.vuerename to resources/js/components/config/ConfigFormLabel.vuediff --git a/resources/js/components/settings/SettingsServer.vue b/resources/js/components/config/ConfigGeneral.vuesimilarity index 61%rename from resources/js/components/settings/SettingsServer.vuerename to resources/js/components/config/ConfigGeneral.vueindex 0418edc0..be971fe4 100644--- a/resources/js/components/settings/SettingsServer.vue+++ b/resources/js/components/config/ConfigGeneral.vue@@ -6,9 +6,9 @@ import { useRouter } from 'vue-router';import { computed } from 'vue';import { useAuth } from '@/composables/auth/useAuth';-import SettingsServerPerformance from '@/components/settings/server/SettingsServerPerformance.vue';-import SettingsServerIndexing from '@/components/settings/server/SettingsServerIndexing.vue';-import SettingsServerStorage from '@/components/settings/server/SettingsServerStorage.vue';+import ConfigServerPerformance from '@/components/config/server/ConfigServerPerformance.vue';+import ConfigServerIndexing from '@/components/config/server/ConfigServerIndexing.vue';+import ConfigServerStorage from '@/components/config/server/ConfigServerStorage.vue';import ProiconsSettings from '~icons/proicons/settings';@@ -22,13 +22,13 @@ if (!isAdmin.value) {const breadCrumbs = computed(() => {const items: BreadCrumbItem[] = [{- name: 'Settings',- url: '/settings/preferences',+ name: 'Config',+ url: '/config',icon: ProiconsSettings,},{- name: 'Server Config',- url: '/settings/server',+ name: 'General Config',+ url: '/config/general',icon: ProiconsSettings,},];@@ -41,7 +41,7 @@ const breadCrumbs = computed(() => {<section class="flex flex-wrap items-center justify-between gap-2"><BreadCrumbs :bread-crumbs="breadCrumbs" /></section>- <SettingsServerIndexing />- <SettingsServerStorage />- <SettingsServerPerformance />+ <ConfigServerIndexing />+ <ConfigServerStorage />+ <ConfigServerPerformance /></template>diff --git a/resources/js/components/settings/SettingToggleRow.vue b/resources/js/components/config/ConfigToggleRow.vuesimilarity index 84%rename from resources/js/components/settings/SettingToggleRow.vuerename to resources/js/components/config/ConfigToggleRow.vueindex 7a7efe46..3a9cc272 100644--- a/resources/js/components/settings/SettingToggleRow.vue+++ b/resources/js/components/config/ConfigToggleRow.vue@@ -1,7 +1,7 @@<script setup lang="ts">import { FormErrorList } from '@/components/cedar-ui/form';-import SettingsFormLabel from '@/components/settings/SettingsFormLabel.vue';+import ConfigFormLabel from '@/components/config/ConfigFormLabel.vue';import ToggleBase from '@/components/inputs/ToggleBase.vue';defineProps<{@@ -17,7 +17,7 @@ const model = defineModel<boolean>();<template><div class="xxs:flex-nowrap flex flex-wrap items-start justify-between gap-x-6 gap-y-2" :class="{ 'pointer-events-none opacity-40': disabled }">- <SettingsFormLabel :for="id" :text="label" :subtext="description" class="my-auto cursor-pointer" />+ <ConfigFormLabel :for="id" :text="label" :subtext="description" class="my-auto cursor-pointer" /><div :class="['flex shrink-0 items-center gap-2', { 'pt-0.5': description }]"><ToggleBase v-model="model" :name="id" class="h-6 w-12 shrink-0 rounded-full dark:border-neutral-700/70 dark:has-checked:border-neutral-700" /><p :class="['text-foreground-1 w-7 shrink-0 text-end text-xs font-medium uppercase']">diff --git a/resources/js/components/settings/server/SettingsServerIndexing.vue b/resources/js/components/config/server/ConfigServerIndexing.vuesimilarity index 92%rename from resources/js/components/settings/server/SettingsServerIndexing.vuerename to resources/js/components/config/server/ConfigServerIndexing.vueindex c0053017..95901ce7 100644--- a/resources/js/components/settings/server/SettingsServerIndexing.vue+++ b/resources/js/components/config/server/ConfigServerIndexing.vue@@ -8,7 +8,7 @@ import { useGetConfig } from '@/service/server/queries';import { ButtonForm } from '@/components/cedar-ui/button';import { watch } from 'vue';-import SettingToggleRow from '@/components/settings/SettingToggleRow.vue';+import ConfigToggleRow from '@/components/config/ConfigToggleRow.vue';import SettingsHeader from '@/components/settings/SettingsHeader.vue';import SettingsCard from '@/components/cards/layout/SettingsCard.vue';@@ -25,8 +25,8 @@ const form = useForm<ScannerConfigRequest>({const handleSaveScanner = () => {form.submit((fields) => saveConfig.mutateAsync(fields), {- onSuccess: () => toast.success('Scanner settings saved.'),- onError: () => toast.error('Failed to save scanner settings.'),+ onSuccess: () => toast.success('Scanner config saved.'),+ onError: () => toast.error('Failed to save scanner config.'),});};@@ -74,7 +74,7 @@ watch(</SettingsHeader><div class="divide-d space-y-4 divide-y *:pb-4 *:last:pb-0">- <SettingToggleRow+ <ConfigToggleRowid="uuid_embed"label="Embed UUID in files"description="Links files to persistent metadata in the database. Increases index time and re-writes each file to disk."@@ -82,7 +82,7 @@ watch(:errors="form.errors"/>- <SettingToggleRow+ <ConfigToggleRowid="uuid_write_cache"label="Use cache for UUID writes"description="Write temporary files to cache. Improves index speed when cache is on an SSD."@@ -91,7 +91,7 @@ watch(:errors="form.errors"/>- <SettingToggleRow+ <ConfigToggleRowid="attachments_extract"label="Extract embedded attachments"description="Automatically extract fonts and subtitle files at index time."@@ -99,7 +99,7 @@ watch(:errors="form.errors"/>- <SettingToggleRow+ <ConfigToggleRowid="thumbnails_generate"label="Generate thumbnails"description="Automatically generate thumbnails at index time."@@ -107,7 +107,7 @@ watch(:errors="form.errors"/>- <SettingToggleRow+ <ConfigToggleRowid="art_extract"label="Extract album art"description="Automatically extract album art from music at index time."diff --git a/resources/js/components/settings/server/SettingsServerPerformance.vue b/resources/js/components/config/server/ConfigServerPerformance.vuesimilarity index 88%rename from resources/js/components/settings/server/SettingsServerPerformance.vuerename to resources/js/components/config/server/ConfigServerPerformance.vueindex 94ae040d..26b89b4e 100644--- a/resources/js/components/settings/server/SettingsServerPerformance.vue+++ b/resources/js/components/config/server/ConfigServerPerformance.vue@@ -8,8 +8,8 @@ import { useGetConfig } from '@/service/server/queries';import { ButtonForm } from '@/components/cedar-ui/button';import { watch } from 'vue';-import SettingsServerSkeleton from '@/components/settings/server/SettingsServerSkeleton.vue';-import SettingsFormLabel from '@/components/settings/SettingsFormLabel.vue';+import ConfigServerSkeleton from '@/components/config/server/ConfigServerSkeleton.vue';+import ConfigFormLabel from '@/components/config/ConfigFormLabel.vue';import SettingsHeader from '@/components/settings/SettingsHeader.vue';import SettingsCard from '@/components/cards/layout/SettingsCard.vue';@@ -49,7 +49,7 @@ watch(</script><template>- <SettingsServerSkeleton v-if="isLoading" />+ <ConfigServerSkeleton v-if="isLoading" /><SettingsCard class="flex-col gap-6" v-else><SettingsHeader><h3 class="text-base font-medium">Performance</h3>@@ -58,7 +58,7 @@ watch(<div class="flex flex-col gap-4"><div class="flex flex-col gap-1">- <SettingsFormLabel+ <ConfigFormLabelfor="max_scan_workers"text="Max parallel scan workers"subtext="Number of processes handling file indexing, thumbnail generation, and UUID embedding."@@ -75,7 +75,7 @@ watch(/></div><div class="flex flex-col gap-1">- <SettingsFormLabel for="max_event_workers" text="Max parallel event workers" subtext="Number of processes handling real-time notifications and page updates." />+ <ConfigFormLabel for="max_event_workers" text="Max parallel event workers" subtext="Number of processes handling real-time notifications and page updates." /><FormNumberFieldv-model="form.fields.max_event_workers":field="{diff --git a/resources/js/components/settings/server/SettingsServerSkeleton.vue b/resources/js/components/config/server/ConfigServerSkeleton.vuesimilarity index 100%rename from resources/js/components/settings/server/SettingsServerSkeleton.vuerename to resources/js/components/config/server/ConfigServerSkeleton.vuediff --git a/resources/js/components/settings/server/SettingsServerStorage.vue b/resources/js/components/config/server/ConfigServerStorage.vuesimilarity index 84%rename from resources/js/components/settings/server/SettingsServerStorage.vuerename to resources/js/components/config/server/ConfigServerStorage.vueindex d422edfd..6ca0cc91 100644--- a/resources/js/components/settings/server/SettingsServerStorage.vue+++ b/resources/js/components/config/server/ConfigServerStorage.vue@@ -8,8 +8,8 @@ import { ButtonForm } from '@/components/cedar-ui/button';import { FormInput } from '@/components/cedar-ui/form';import { watch } from 'vue';-import SettingsServerSkeleton from '@/components/settings/server/SettingsServerSkeleton.vue';-import SettingsFormLabel from '@/components/settings/SettingsFormLabel.vue';+import ConfigServerSkeleton from '@/components/config/server/ConfigServerSkeleton.vue';+import ConfigFormLabel from '@/components/config/ConfigFormLabel.vue';import SettingsHeader from '@/components/settings/SettingsHeader.vue';import SettingsCard from '@/components/cards/layout/SettingsCard.vue';@@ -51,7 +51,7 @@ watch(</script><template>- <SettingsServerSkeleton v-if="isLoading" />+ <ConfigServerSkeleton v-if="isLoading" /><SettingsCard class="flex-col gap-6" v-else><SettingsHeader><h3 class="text-base font-medium">Storage Paths</h3>@@ -60,13 +60,13 @@ watch(<div class="flex flex-col gap-4"><div class="flex flex-col gap-1">- <SettingsFormLabel for="cache_path" text="Cache path" :subtext="'Temporary files are written here. Point to an SSD to improve speed.'" />+ <ConfigFormLabel for="cache_path" text="Cache path" :subtext="'Temporary files are written here. Point to an SSD to improve speed.'" /><FormInput v-model="form.fields.cache_path" :field="{ name: 'cache_path', type: 'text', placeholder: 'storage/cache/' }" /><FormErrorList :errors="form.errors" :field-name="'cache_path'" /></div><div class="flex flex-col gap-1">- <SettingsFormLabel for="metadata_path" text="Metadata path" :subtext="'Metadata files (subtitles, thumbnails, art) are written here.'" />+ <ConfigFormLabel for="metadata_path" text="Metadata path" :subtext="'Metadata files (subtitles, thumbnails, art) are written here.'" /><FormInput v-model="form.fields.metadata_path" :field="{ name: 'metadata_path', type: 'text', placeholder: 'storage/metadata/' }" /><FormErrorList :errors="form.errors" :field-name="'metadata_path'" /></div>diff --git a/resources/js/components/panels/ConfigTabs.ts b/resources/js/components/panels/ConfigTabs.tsnew file mode 100644index 00000000..538e67e6--- /dev/null+++ b/resources/js/components/panels/ConfigTabs.ts@@ -0,0 +1,53 @@+import type { SidebarTabItem } from '@/types/types';++import { computed, ref, watch } from 'vue';+import { useAppStore } from '@/stores/AppStore';+import { storeToRefs } from 'pinia';+import { useRoute } from 'vue-router';+import { useAuth } from '@/composables/auth/useAuth';++import ProiconsSettings from '~icons/proicons/settings';++export function useConfigTabs() {+ const { isAdmin, userData } = useAuth();+ const { pageTitle } = storeToRefs(useAppStore());++ const route = useRoute();++ const configTab = ref<{ name: string; title?: string; icon?: any }>();+ const configTabs = computed<SidebarTabItem[]>(() => {+ return [+ {+ name: 'general',+ title: 'general',+ description: 'General Server Configuration', // Server features+ disabled: !isAdmin.value,+ icon: ProiconsSettings,+ },+ ];+ });++ watch(+ () => route?.params?.tab,+ (URL_TAB) => {+ if (!URL_TAB) return;+ const defaultTab = configTabs.value.find((tab) => tab.title === URL_TAB || tab.name === URL_TAB) ?? configTabs.value[0];++ pageTitle.value = defaultTab.title ?? defaultTab.name;+ configTab.value = defaultTab;+ },+ { immediate: true },+ );++ watch(+ () => configTab.value,+ () => {+ if (!configTab.value) return;+ pageTitle.value = configTab.value.title ?? configTab.value.name;+ },+ );+ return {+ configTabs,+ activeConfigTab: configTab,+ };+}diff --git a/resources/js/components/panels/DropdownMenuItems.ts b/resources/js/components/panels/DropdownMenuItems.tsindex 7dfd6309..ee286e78 100644--- a/resources/js/components/panels/DropdownMenuItems.ts+++ b/resources/js/components/panels/DropdownMenuItems.ts@@ -79,6 +79,7 @@ export function useDropdownMenuItems() {{ ...defaults, name: 'history', url: '/history', text: 'Full History', icon: LucideHistory },{ ...defaults, name: 'overview', url: '/dashboard', text: 'Insights', icon: LucideLayoutDashboard, disabled: true, hidden: !FLAGS.USE_INSIGHTS_UI },],+ [{ ...defaults, name: 'config', url: '/config', text: 'Server Config', icon: ProiconsSettings, hidden: !isAdmin.value }],[{...defaults,diff --git a/resources/js/components/panels/LeftSidebar.vue b/resources/js/components/panels/LeftSidebar.vuenew file mode 100644index 00000000..2bcb1698--- /dev/null+++ b/resources/js/components/panels/LeftSidebar.vue@@ -0,0 +1,49 @@+<script setup lang="ts">+import { useSettingsTabs } from '@/components/panels/SettingsTabs';+import { useConfigTabs } from '@/components/panels/ConfigTabs';+import { useRoute } from 'vue-router';+import { computed } from 'vue';++import DashboardSidebarCard from '@/components/cards/sidebar/DashboardSidebarCard.vue';+import AppManifestCard from '@/components/cards/data/AppManifestCard.vue';+import SidebarHeader from '@/components/headers/SidebarHeader.vue';++const { configTabs, activeConfigTab } = useConfigTabs();+const { settingsTabs, activeSettingsTab } = useSettingsTabs();++const route = useRoute();++const activeRoute = computed(() => (route.name === 'config' ? 'config' : 'settings'));++const tabs = computed(() => (route.name === 'config' ? configTabs.value : settingsTabs.value));++const activeTab = computed(() => (route.name === 'config' ? activeConfigTab.value : activeSettingsTab.value));+</script>++<template>+ <SidebarHeader />+ <div class="full-height-sidebar flex h-full flex-1 flex-col gap-2">+ <DashboardSidebarCard+ v-for="(tab, index) in tabs.filter((tab) => !tab.disabled)"+ :key="index"+ :to="`/${activeRoute}/${tab.name}`"+ :disabled="tab.disabled"+ :is-active="activeTab?.name === tab.name"+ @click="activeTab = tab"+ >+ <template #header>+ <h3 class="w-full flex-1 truncate" :title="tab.title ?? tab.name">{{ tab.title ?? tab.name }}</h3>+ <component v-if="tab.icon" :is="tab.icon" class="ml-auto size-5" />+ </template>+ <template #body>+ <h4 v-if="tab.description" title="Description" class="w-full flex-1 truncate text-wrap sm:text-nowrap">+ {{ tab.description }}+ </h4>+ <h4 v-if="tab.info" title="Information" class="w-fit truncate text-nowrap sm:text-right">+ {{ tab.info.value }}+ </h4>+ </template>+ </DashboardSidebarCard>+ <AppManifestCard :class="'mt-auto'" />+ </div>+</template>diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vueindex 93d9edbd..02d202c6 100755--- a/resources/js/components/panels/NavBar.vue+++ b/resources/js/components/panels/NavBar.vue@@ -53,7 +53,7 @@ const toggleVideoSidebar = (sidebar: 'folders' | 'history') => {};// Hardcoded could be much better elsewhere-const toggleLeftSidebar = (sidebar: 'dashboard' | 'settings') => {+const toggleLeftSidebar = (sidebar: 'dashboard' | 'settings' | 'config') => {cycleSideBar(sidebar, 'left-card', false);if (selectedSideBar.value !== sidebar) return;@@ -86,6 +86,9 @@ watch(isDesktop, (now) => {case 'home':toggleVideoSidebar(currentSidebar === 'history' ? 'history' : 'folders');break;+ case 'config':+ toggleLeftSidebar('config');+ break;case 'settings':case 'preferences':toggleLeftSidebar('settings');@@ -187,6 +190,16 @@ watch(isDesktop, (now) => {><ProiconsMenu height="20" width="20" /></NavButton>+ <NavButton+ v-if="$route.name === 'config'"+ @click="toggleLeftSidebar('config')"+ :label="'config'"+ :active="selectedSideBar === 'config'"+ title="Toggle config menu"+ class="p-0"+ >+ <ProiconsMenu height="20" width="20" />+ </NavButton><NavLink v-if="$route.name != 'home'" label="home" to="/" title="Return to home library" class="p-0"><CircumMonitor height="24" width="24" /></NavLink>diff --git a/resources/js/components/panels/SettingsTabs.ts b/resources/js/components/panels/SettingsTabs.tsindex 87fef4af..2f429e49 100644--- a/resources/js/components/panels/SettingsTabs.ts+++ b/resources/js/components/panels/SettingsTabs.ts@@ -10,7 +10,7 @@ import ProiconsSettings from '~icons/proicons/settings';import LucideUser from '~icons/lucide/user';export function useSettingsTabs() {- const { isAdmin, userData } = useAuth();+ const { userData } = useAuth();const { pageTitle } = storeToRefs(useAppStore());const route = useRoute();@@ -38,13 +38,6 @@ export function useSettingsTabs() {description: 'Profile Settings', // Visibility, Avatar, Bannerdisabled: dev || !userData.value,},- {- name: 'server',- title: 'Server',- description: 'Server Configuration', // Server features- disabled: !isAdmin.value,- icon: ProiconsSettings,- },];});diff --git a/resources/js/router/index.ts b/resources/js/router/index.tsindex dd64b5be..5016b520 100644--- a/resources/js/router/index.ts+++ b/resources/js/router/index.ts@@ -121,6 +121,17 @@ export const router = createRouter({path: '/settings',redirect: '/settings/preferences',},+ {+ path: '/config/:tab/:id?',+ name: 'config',+ meta: { protected: true, redirect: '/config/general' },+ component: () => import('@/views/ConfigView.vue'),+ props: true,+ },+ {+ path: '/config',+ redirect: '/config/general',+ },{path: '/dashboard/:tab/:id?',name: 'dashboard',diff --git a/resources/js/views/ConfigView.vue b/resources/js/views/ConfigView.vuenew file mode 100644index 00000000..778dd405--- /dev/null+++ b/resources/js/views/ConfigView.vue@@ -0,0 +1,34 @@+<script setup lang="ts">+import { useConfigTabs } from '@/components/panels/ConfigTabs';+import { getScreenSize } from '@/service/util';+import { useAppStore } from '@/stores/AppStore';+import { onMounted } from 'vue';++import ConfigGeneral from '@/components/config/ConfigGeneral.vue';+import LeftSidebar from '@/components/panels/LeftSidebar.vue';+import LayoutBase from '@/layouts/LayoutBase.vue';++const { activeConfigTab } = useConfigTabs();+const { cycleSideBar } = useAppStore();++onMounted(async () => {+ const screenSize = getScreenSize();++ if (screenSize === 'default' || screenSize === 'sm' || screenSize === 'md') return;++ cycleSideBar('config', 'left-card', false);+});+</script>++<template>+ <LayoutBase>+ <template v-slot:content>+ <section id="content-config" class="page-height flex flex-col gap-4 text-sm">+ <ConfigGeneral v-if="activeConfigTab?.name == 'general'" />+ </section>+ </template>+ <template v-slot:leftSidebar>+ <LeftSidebar />+ </template>+ </LayoutBase>+</template>diff --git a/resources/js/views/SettingsView.vue b/resources/js/views/SettingsView.vueindex f454d3e1..1de84f74 100755--- a/resources/js/views/SettingsView.vue+++ b/resources/js/views/SettingsView.vue@@ -7,7 +7,6 @@ import { onMounted } from 'vue';import SettingsPreferences from '@/components/settings/SettingsPreferences.vue';import SettingsAccount from '@/components/settings/SettingsAccount.vue';import SettingsSidebar from '@/components/panels/SettingsSidebar.vue';-import SettingsServer from '@/components/settings/SettingsServer.vue';import LayoutBase from '@/layouts/LayoutBase.vue';const { activeSettingsTab } = useSettingsTabs();@@ -28,7 +27,6 @@ onMounted(async () => {<section id="content-settings" class="page-height flex flex-col gap-4 text-sm"><SettingsPreferences v-if="activeSettingsTab?.name == 'preferences'" /><SettingsAccount v-if="activeSettingsTab?.name == 'account'" />- <SettingsServer v-if="activeSettingsTab?.name == 'server'" /></section></template><template v-slot:leftSidebar>