enhanced server settings section

This commit is contained in:
2026-01-01 17:53:50 +01:00
parent d7ab08c022
commit 01ae038a8b
21 changed files with 540 additions and 418 deletions

View File

@@ -11,6 +11,22 @@ const DEFAULT_CONFIG = {
anime: null,
manga: null,
novels: null
},
paths: {
mpv: null,
ffmpeg: null
}
};
export const CONFIG_SCHEMA = {
library: {
anime: { description: "Path where anime is stored" },
manga: { description: "Path where manga is stored" },
novels: { description: "Path where novels are stored" }
},
paths: {
mpv: { description: "Required to open anime episodes in mpv on desktop version." },
ffmpeg: { description: "Required for downloading anime episodes." }
}
};
@@ -31,7 +47,12 @@ function ensureConfigFile() {
export function getConfig() {
ensureConfigFile();
const raw = fs.readFileSync(CONFIG_PATH, 'utf8');
return yaml.load(raw) || DEFAULT_CONFIG;
const loaded = yaml.load(raw) || {};
return {
values: deepMerge(structuredClone(DEFAULT_CONFIG), loaded),
schema: CONFIG_SCHEMA
};
}
export function setConfig(partialConfig) {