enhanced server settings section
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user