ui: new config page

This commit is contained in:
undefined committed 2025-03-08 18:06:16 +08:00
1 parent d009eb4147
commit 0aecafcd00
8 files changed
+179 -51

No files matched your search

+5 -4
View File
@@ -183,12 +183,12 @@ class SystemConfigHandler extends SystemHandler {
@requireSudo
async get() {
this.response.template = 'manage_config.html';
let value = this.ctx.config.configSource;
let value = this.ctx.get('config').configSource;
try {
value = yaml.dump(Schema.intersect(this.ctx.config.settings)(yaml.load(value)));
value = yaml.dump(Schema.intersect(this.ctx.get('config').settings)(yaml.load(value)));
} catch (e) { }
this.response.body = {
schema: Schema.intersect(this.ctx.config.settings).toJSON(),
schema: Schema.intersect(this.ctx.get('config').settings).toJSON(),
value,
};
}
@@ -202,7 +202,7 @@ class SystemConfigHandler extends SystemHandler {
} catch (e) {
throw new ValidationError('value');
}
await this.ctx.config.saveConfig(config);
await this.ctx.get('config').saveConfig(config);
}
}
@@ -321,6 +321,7 @@ class SystemUserPrivHandler extends SystemHandler {
}
}
export const inject = ['config'];
export async function apply(ctx) {
ctx.Route('manage', '/manage', SystemMainHandler);
ctx.Route('manage_dashboard', '/manage/dashboard', SystemDashboardHandler);