core: bug fixes

This commit is contained in:
undefined committed 2025-03-16 01:11:03 +08:00
1 parent aa75195250
commit e0628c6197
4 files changed
+37 -28

No files matched your search

+3 -3
View File
@@ -183,7 +183,7 @@ class SystemConfigHandler extends SystemHandler {
@requireSudo
async get() {
this.response.template = 'manage_config.html';
let value = this.ctx.config.configSource;
let value;
const processNode = (node: any, schema: Schema<any, any>, parent?: any, accessKey?: string) => {
if (['union', 'intersect'].includes(schema.type)) {
@@ -199,7 +199,7 @@ class SystemConfigHandler extends SystemHandler {
};
try {
value = Schema.intersect(this.ctx.config.settings)(yaml.load(value));
value = Schema.intersect(this.ctx.config.settings)(yaml.load(this.ctx.config.configSource));
for (const schema of this.ctx.config.settings) processNode(value, schema);
} catch (e) { }
this.response.body = {
@@ -218,7 +218,7 @@ class SystemConfigHandler extends SystemHandler {
for (const item of schema.list) processNode(node, old, item, parent, accessKey);
}
if (parent && (schema.meta.secret === true || schema.meta.role === 'secret')) {
if (node === '[hidden]') parent[accessKey] = old[accessKey];
if (node === '[hidden]') parent[accessKey] = old;
// TODO support more types
}
if (schema.type === 'object') {