mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: add dark theme support to manage_config
This commit is contained in:
5 files changed
+36
-18
No files matched your search
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user