allow custom css

This commit is contained in:
KingKDot
2026-03-25 09:50:41 -05:00
parent 66fdf578b7
commit 7b5037bc18
7 changed files with 181 additions and 1 deletions
+24
View File
@@ -55,6 +55,9 @@ export interface Config {
enrollment: {
requireApproval: boolean;
};
appearance: {
customCSS: string;
};
}
const DEFAULT_CONFIG: Config = {
@@ -108,6 +111,9 @@ const DEFAULT_CONFIG: Config = {
enrollment: {
requireApproval: true,
},
appearance: {
customCSS: "",
},
};
type SaveSecrets = {
@@ -423,6 +429,9 @@ export function loadConfig(): Config {
? String(process.env.OVERLORD_ENROLLMENT_REQUIRE_APPROVAL).toLowerCase() === "true"
: (fileConfig.enrollment?.requireApproval ?? DEFAULT_CONFIG.enrollment.requireApproval),
},
appearance: {
customCSS: fileConfig.appearance?.customCSS || DEFAULT_CONFIG.appearance.customCSS,
},
};
if (saveChanged) {
@@ -591,3 +600,18 @@ export async function updateTlsConfig(
await writePersistentFileConfig(fileConfig);
return next;
}
export async function updateAppearanceConfig(customCSS: string): Promise<Config["appearance"]> {
const current = getConfig();
const next = { customCSS: String(customCSS || "").slice(0, 51200) };
configCache = {
...current,
appearance: next,
};
const fileConfig = readFileConfigForUpdate();
fileConfig.appearance = next;
await writePersistentFileConfig(fileConfig);
return next;
}