Skip to content

A self-hosted media server and file management system

fix: user can't tell if a specific config option is unsupported

aminnausin4cb0d215c9be
diff --git a/resources/css/cedar-base.css b/resources/css/cedar-base.css
index c220e99f..7fb060f9 100644
--- a/resources/css/cedar-base.css
+++ b/resources/css/cedar-base.css
@@ -137,4 +137,8 @@ Default Cedar-UI Scrollbar code interferes with what I have here
.button-disabled-pointer {
@apply pointer-events-none;
}
+
+ .input-disabled {
+ @apply pointer-events-none opacity-40;
+ }
}
diff --git a/resources/js/components/config/ConfigToggleRow.vue b/resources/js/components/config/ConfigToggleRow.vue
index 3a9cc272..f613121c 100644
--- a/resources/js/components/config/ConfigToggleRow.vue
+++ b/resources/js/components/config/ConfigToggleRow.vue
@@ -16,7 +16,7 @@ const model = defineModel<boolean>();
</script>
<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 }">
+ <div class="xxs:flex-nowrap flex flex-wrap items-start justify-between gap-x-6 gap-y-2" :class="{ 'input-disabled': disabled }">
<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" />
diff --git a/resources/js/components/config/server/ConfigServerFileTypes.vue b/resources/js/components/config/server/ConfigServerFileTypes.vue
index 1cb401b0..5c2cc440 100644
--- a/resources/js/components/config/server/ConfigServerFileTypes.vue
+++ b/resources/js/components/config/server/ConfigServerFileTypes.vue
@@ -111,13 +111,16 @@ watch(serverConfig, setSavedExtensions, { immediate: true });
<template>
<SettingsCard :class="['flex-col gap-6 truncate', { 'animate-pulse': isLoading }]">
<template #content>
- <ConfigHeader :heading="'Supported File Types'" :dirty="form.dirty"> Only selected file types will be scanned. </ConfigHeader>
+ <ConfigHeader :heading="'Supported File Types'" :dirty="form.dirty">
+ Only selected file types will be scanned
+ <span v-if="!FLAGS.CONFIG.USE_FILE_TYPES">(unsupported)</span>.
+ </ConfigHeader>
<div class="flex w-full flex-col gap-4 font-medium">
<div
class="flex flex-col gap-2"
v-for="section in SECTIONS.filter((sec) => {
- if (sec.name === 'subtitles' && !FLAGS.USE_SUBTITLE_EXTENTION_CONFIG) return false;
+ if (sec.name === 'subtitles' && !FLAGS.CONFIG.USE_SUBTITLE_EXTENTION_CONFIG) return false;
return true;
})"
:key="section.name"
diff --git a/resources/js/components/config/server/ConfigServerIndexing.vue b/resources/js/components/config/server/ConfigServerIndexing.vue
index 74a0c07c..bfbaa0c7 100644
--- a/resources/js/components/config/server/ConfigServerIndexing.vue
+++ b/resources/js/components/config/server/ConfigServerIndexing.vue
@@ -6,6 +6,7 @@ import { FormErrorList } from '@/components/cedar-ui/form';
import { useGetConfig } from '@/service/server/queries';
import { ButtonForm } from '@/components/cedar-ui/button';
import { cn, toast } from '@aminnausin/cedar-ui';
+import { FLAGS } from '@/config/featureFlags';
import { watch } from 'vue';
import ConfigToggleRow from '@/components/config/ConfigToggleRow.vue';
@@ -75,43 +76,47 @@ watch(
<div class="divide-d space-y-4 divide-y *:pb-4 *:last:pb-0">
<ConfigToggleRow
id="uuid_embed"
- label="Embed UUID in files"
+ :label="`Embed UUID in files${FLAGS.CONFIG.USE_EMBED_UUID_TOGGLE ? '' : ' (unsupported)'}`"
description="Links files to persistent metadata in the database. Increases index time and re-writes each file to disk."
v-model="form.fields.uuid_embed"
:errors="form.errors"
+ :disabled="!FLAGS.CONFIG.USE_EMBED_UUID_TOGGLE"
/>
<ConfigToggleRow
id="uuid_write_cache"
- label="Use cache for UUID writes"
+ :label="`Use cache for UUID writes${FLAGS.CONFIG.USE_EMBED_CACHE_TOGGLE ? '' : ' (unsupported)'}`"
description="Write temporary files to cache. Improves index speed when cache is on an SSD."
v-model="form.fields.uuid_write_cache"
- :disabled="!form.fields.uuid_embed"
+ :disabled="!form.fields.uuid_embed || !FLAGS.CONFIG.USE_EMBED_CACHE_TOGGLE"
:errors="form.errors"
/>
<ConfigToggleRow
id="attachments_extract"
- label="Extract embedded attachments"
+ :label="`Extract embedded attachments${FLAGS.CONFIG.USE_EXTRACT_ATTACHMENTS_TOGGLE ? '' : ' (unsupported)'}`"
description="Automatically extract fonts and subtitle files at index time."
v-model="form.fields.attachments_extract"
:errors="form.errors"
+ :disabled="!FLAGS.CONFIG.USE_EXTRACT_ATTACHMENTS_TOGGLE"
/>
<ConfigToggleRow
id="thumbnails_generate"
- label="Generate thumbnails"
+ :label="`Generate thumbnails${FLAGS.CONFIG.USE_GENERATE_THUMBNAILS_TOGGLE ? '' : ' (unsupported)'}`"
description="Automatically generate thumbnails at index time."
v-model="form.fields.thumbnails_generate"
:errors="form.errors"
+ :disabled="!FLAGS.CONFIG.USE_GENERATE_THUMBNAILS_TOGGLE"
/>
<ConfigToggleRow
id="art_extract"
- label="Extract album art"
+ :label="`Extract album art${FLAGS.CONFIG.USE_EXTRACT_ART_TOGGLE ? '' : ' (unsupported)'}`"
description="Automatically extract album art from music at index time."
v-model="form.fields.art_extract"
:errors="form.errors"
+ :disabled="!FLAGS.CONFIG.USE_EXTRACT_ART_TOGGLE"
/>
</div>
diff --git a/resources/js/components/config/server/ConfigServerStorage.vue b/resources/js/components/config/server/ConfigServerStorage.vue
index de7f6fdc..483e825b 100644
--- a/resources/js/components/config/server/ConfigServerStorage.vue
+++ b/resources/js/components/config/server/ConfigServerStorage.vue
@@ -16,6 +16,7 @@ import ConfigHeader from '@/components/config/ConfigHeader.vue';
import FormErrorList from '@/components/cedar-ui/form/FormErrorList.vue';
import FormFooter from '@/components/forms/FormFooter.vue';
import useForm from '@/composables/useForm';
+import { FLAGS } from '@/config/featureFlags';
const { data: serverConfig, isLoading } = useGetConfig();
const saveConfig = UseUpdateStorageConfig();
@@ -58,14 +59,22 @@ watch(
<ConfigHeader :heading="'Storage Paths'" :dirty="form.dirty"> Override where the server writes data. </ConfigHeader>
<div class="flex flex-col gap-4">
- <div class="flex flex-col gap-1">
- <ConfigFormLabel for="cache_path" text="Cache path" :subtext="'Temporary files are written here. Point to an SSD to improve speed.'" />
+ <div :class="cn('flex flex-col gap-1', { 'input-disabled': !FLAGS.CONFIG.USE_CACHE_PATH })">
+ <ConfigFormLabel
+ for="cache_path"
+ :text="`Cache path${FLAGS.CONFIG.USE_CACHE_PATH ? '' : ' (unsupported)'}`"
+ :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">
- <ConfigFormLabel for="metadata_path" text="Metadata path" :subtext="'Metadata files (subtitles, thumbnails, art) are written here.'" />
+ <div :class="cn('flex flex-col gap-1', { 'input-disabled': !FLAGS.CONFIG.USE_METADATA_PATH })">
+ <ConfigFormLabel
+ for="metadata_path"
+ :text="`Metadata path${FLAGS.CONFIG.USE_METADATA_PATH ? '' : ' (unsupported)'}`"
+ :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/config/featureFlags.ts b/resources/js/config/featureFlags.ts
index 9debfea1..17d11e92 100644
--- a/resources/js/config/featureFlags.ts
+++ b/resources/js/config/featureFlags.ts
@@ -10,6 +10,18 @@ export const FLAGS = {
USE_APP_VERSION_CARD: true, // show app manifest/version card in sidebars (settings and dashboard)
USE_ASYMMETRICAL_PLAYER: false,
- USE_MEDIA_EXTENTION_CONFIG: true, // Allow setting supported extentions
- USE_SUBTITLE_EXTENTION_CONFIG: false, // Allow setting supported subtitle extentions
+ CONFIG: {
+ USE_MEDIA_EXTENTION_CONFIG: true, // Allow setting supported extentions
+ USE_SUBTITLE_EXTENTION_CONFIG: false, // Allow setting supported subtitle extentions
+
+ USE_EMBED_UUID_TOGGLE: true,
+ USE_EMBED_CACHE_TOGGLE: false,
+ USE_EXTRACT_ATTACHMENTS_TOGGLE: false,
+ USE_GENERATE_THUMBNAILS_TOGGLE: false,
+ USE_EXTRACT_ART_TOGGLE: true,
+ USE_CACHE_PATH: false,
+ USE_METADATA_PATH: false,
+ USE_FILE_TYPES: false,
+ USE_QUEUE_LIMITS: true,
+ },
};