mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: new config page
This commit is contained in:
8 files changed
+179
-51
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user