core&ui: add dark theme support to manage_config

This commit is contained in:
undefined committed 2025-06-08 23:07:05 +08:00
1 parent 2305e168f0
commit b70b685b01
5 files changed
+36 -18

No files matched your search

+5 -8
View File
@@ -182,7 +182,7 @@ class SystemConfigHandler extends SystemHandler {
@requireSudo
async get() {
this.response.template = 'manage_config.html';
let value;
let value = this.ctx.setting.configSource;
const processNode = (node: any, schema: Schema<any, any>, parent?: any, accessKey?: string) => {
if (['union', 'intersect'].includes(schema.type)) {
@@ -198,16 +198,13 @@ class SystemConfigHandler extends SystemHandler {
};
try {
try {
value = Schema.intersect(this.ctx.setting.settings)(yaml.load(this.ctx.setting.configSource));
} catch (e) {
value = yaml.load(this.ctx.setting.configSource);
}
for (const schema of this.ctx.setting.settings) processNode(value, schema);
const temp = yaml.load(this.ctx.setting.configSource);
for (const schema of this.ctx.setting.settings) processNode(temp, schema);
value = yaml.dump(temp);
} catch (e) { }
this.response.body = {
schema: Schema.intersect(this.ctx.setting.settings).toJSON(),
value: yaml.dump(value),
value,
};
}
+4 -5
View File
@@ -26,11 +26,6 @@ for (const country of countries) {
const timezones = Array.from(tzs).sort().map((tz) => [tz, tz]) as [string, string][];
const langRange: Dictionary<string> = {};
for (const lang in global.Hydro.locales) {
if (!global.Hydro.locales[lang].__interface) continue;
langRange[lang] = global.Hydro.locales[lang].__langname;
}
export const FLAG_HIDDEN = 1;
export const FLAG_DISABLED = 2;
export const FLAG_SECRET = 4;
@@ -364,6 +359,10 @@ export const langs: Record<string, LangConfig> = {};
export const inject = ['db'];
export async function apply(ctx: Context) {
logger.info('Ensuring settings');
for (const lang in global.Hydro.locales) {
if (!global.Hydro.locales[lang].__interface) continue;
langRange[lang] = global.Hydro.locales[lang].__langname;
}
const system = global.Hydro.model.system;
for (const setting of SYSTEM_SETTINGS) {
if (!setting.value) continue;