feat: add configurable headers and instance branding

This commit is contained in:
ajnart committed 2026-08-23 22:28:13 +02:00
1 parent ec295fe26e
commit 86550aadc9
93 files changed
+28223 -567

No files matched your search

+30 -4
View File
@@ -1,7 +1,12 @@
import SuperJSON from "superjson";
import type { ServerSettings } from "@homarr/server-settings";
import { defaultServerSettings, defaultServerSettingsKeys } from "@homarr/server-settings";
import {
defaultServerSettings,
defaultServerSettingsKeys,
parseBrandingSettings,
parseFeatureControls,
} from "@homarr/server-settings";
import type { Database } from "..";
import { eq } from "..";
@@ -18,10 +23,20 @@ export const getServerSettingsAsync = async (db: Database) => {
return acc;
}
const parsedSetting = SuperJSON.parse<Record<string, unknown>>(setting.value);
if (settingKey === "branding") {
acc[settingKey] = parseBrandingSettings(parsedSetting) as never;
return acc;
}
if (settingKey === "featureControls") {
acc[settingKey] = parseFeatureControls(parsedSetting) as never;
return acc;
}
acc[settingKey] = {
...defaultServerSettings[settingKey],
...SuperJSON.parse(setting.value),
};
...parsedSetting,
} as never;
return acc;
}, {} as ServerSettings);
};
@@ -35,7 +50,18 @@ export const getServerSettingByKeyAsync = async <TKey extends keyof ServerSettin
return defaultServerSettings[key];
}
return SuperJSON.parse<ServerSettings[TKey]>(dbSettings.value);
const parsedSetting = SuperJSON.parse<ServerSettings[TKey]>(dbSettings.value);
if (key === "branding") {
return parseBrandingSettings(parsedSetting) as ServerSettings[TKey];
}
if (key === "featureControls") {
return parseFeatureControls(parsedSetting) as ServerSettings[TKey];
}
return {
...defaultServerSettings[key],
...parsedSetting,
} as ServerSettings[TKey];
};
export const updateServerSettingByKeyAsync = async <TKey extends keyof ServerSettings>(