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') {
+3 -4
View File
@@ -291,9 +291,8 @@ const oi = buildContestRule({
continue;
}
if (!detail[j.pid] || detail[j.pid].score < j.score || this.submitAfterAccept) {
detail[j.pid] = j;
display[j.pid] ||= {};
display[j.pid] = j;
detail[j.pid] = { ...j };
display[j.pid] = { ...j };
}
}
for (const i in display) {
@@ -360,7 +359,7 @@ const oi = buildContestRule({
accepted[s.pid] = true;
}
}
const tsddict = (config.lockAt ? tsdoc.display : tsdoc.detail) || {};
const tsddict = ((config.lockAt && isLocked(tdoc, new Date())) ? tsdoc.display : tsdoc.detail) || {};
for (const pid of tdoc.pids) {
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
// eslint-disable-next-line @typescript-eslint/no-use-before-define
+2 -2
View File
@@ -158,11 +158,11 @@ export default class HMR extends Service {
for (const filename in require.cache) {
const module = require.cache[filename];
const plugin = unwrapExports(module.exports);
if (typeof plugin !== 'object' || !plugin || !('apply' in plugin)) continue;
if (!plugin) continue;
const runtime = this.ctx.registry.get(plugin);
if (!runtime || this.declined.has(filename)) continue;
pending.set(filename, plugin);
if (!plugin || !('sideEffect' in plugin) || !plugin['sideEffect']) this.declined.add(filename);
if (!plugin?.sideEffect) this.declined.add(filename);
}
for (const [filename, plugin] of pending) {