feat: add administrators, require administrator perms to change server config in webui #628

Merged
Sainan merged 6 commits from permissions into main 2024-12-23 13:44:01 -08:00
Showing only changes of commit 6e27eea7bb - Show all commits

View File

@ -14,6 +14,13 @@ fs.watchFile(configPath, () => {
amnesia = false; amnesia = false;
} else { } else {
logger.info("Detected a change to config.json, reloading its contents."); logger.info("Detected a change to config.json, reloading its contents.");
// Set all values to undefined now so if the new config.json omits some fields that were previously present, it's correct in-memory.
for (const key of Object.keys(config)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
(config as any)[key] = undefined;
}
Object.assign(config, JSON.parse(fs.readFileSync(configPath, "utf-8"))); Object.assign(config, JSON.parse(fs.readFileSync(configPath, "utf-8")));
} }
}); });