allow custom css
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user