bug fixes

This commit is contained in:
undefined committed 2025-03-17 07:48:40 +08:00
1 parent 3c65c27911
commit 80d2137cbb
6 files changed
+19 -25

No files matched your search

+1
View File
@@ -132,6 +132,7 @@ Hydro 用户群:1085853538
- ui: 更新系统设置页面样式
- import-qduoj: 修复 spj=null
- core: 修复文件复制
- core: 支持存储并显示提交记录重测历史
### Breaking API Changes
+3 -2
View File
@@ -36,11 +36,11 @@ if (CI && (!tag || GITHUB_EVENT_NAME !== 'push')) {
if (tag === 'dev') {
try {
const result = await packageJson(meta.name, { version: meta.version });
if (typeof result?.version === meta.version) return progress++; // no change on dev version
if (result?.version === meta.version) return progress++; // no change on dev version
} catch (e) {
// expected
}
}
} else if (prerelease(meta.version)) return progress++; // Refuse to publish prerelease as 'latest' tag
if (!meta.private && /^[0-9.]+$/.test(meta.version)) {
try {
const { version } = await packageJson(meta.name, { version: tag });
@@ -57,6 +57,7 @@ if (CI && (!tag || GITHUB_EVENT_NAME !== 'push')) {
console.error(e);
}
spinner.text = `Loading workspaces (${++progress}/${folders.length})`;
return progress;
}));
spinner.succeed();
+8 -4
View File
@@ -234,7 +234,7 @@ export default class RecordModel {
}
static async reset(domainId: string, rid: MaybeArray<ObjectId>, isRejudge: boolean) {
const rids = rid instanceof Array ? rid : [rid];
const rids = Array.isArray(rid) ? rid : [rid];
const upd: any = {
score: 0,
status: STATUS.STATUS_WAITING,
@@ -281,7 +281,7 @@ export default class RecordModel {
}
}
export function apply(ctx: Context) {
export async function apply(ctx: Context) {
// Mark problem as deleted
ctx.on('problem/delete', (domainId, docId) => Promise.all([
RecordModel.coll.deleteMany({ domainId, pid: docId }),
@@ -305,7 +305,7 @@ export function apply(ctx: Context) {
}, { upsert: true });
}
});
ctx.on('ready', () => Promise.all([
await Promise.all([
db.ensureIndexes(
RecordModel.coll,
{ key: { domainId: 1, pid: 1 }, name: 'delete' },
@@ -322,6 +322,10 @@ export function apply(ctx: Context) {
{ key: { domainId: 1, pid: 1, uid: 1, memory: 1 }, name: 'memory' },
{ key: { domainId: 1, pid: 1, uid: 1, length: 1 }, name: 'length' },
),
]) as any);
db.ensureIndexes(
RecordModel.collHistory,
{ key: { rid: 1, _id: -1 }, name: 'basic' },
),
]);
}
global.Hydro.model.record = RecordModel;
+5 -5
View File
@@ -7,13 +7,13 @@ import { Context, Service } from '../context';
import { PERM, PRIV } from '../model/builtin';
import { Handler } from './server';
const types: Record<string, Record<string, string>> = {};
const unions: Record<string, string> = {};
const descriptions: Record<string, Record<string, string>> = {};
const types: Record<string, Record<string, string>> = Object.create(null);
const unions: Record<string, string> = Object.create(null);
const descriptions: Record<string, Record<string, string>> = Object.create(null);
const handlers: Record<string, Record<string, any>> = {
Query: {},
Query: Object.create(null),
};
let root: Record<string, any> = {};
let root: Record<string, any> = Object.create(null);
interface ApiContext extends ApiHandler {
[key: string]: any;
+1 -13
View File
@@ -1,22 +1,11 @@
import path from 'path';
import {
ContestModel, Context, fs, Handler, ObjectId, PERM, Schema, STATUS, Types, UserModel,
ContestModel, Context, fs, ObjectId, PERM, Schema, STATUS, Types, UserModel,
} from 'hydrooj';
const file = fs.readFileSync(path.join(__dirname, 'public/assets/board.html'), 'utf8');
const indexJs = file.match(/index-([A-Za-z0-9_-]+)\.js"/)?.[1];
const indexCss = file.match(/index-([A-Za-z0-9_-]+)\.css"/)?.[1];
class XcpcioHandler extends Handler {
async get() {
this.response.body = {
js: indexJs,
css: indexCss,
};
this.response.template = 'xcpcio_board.html';
}
}
const status = {
[STATUS.STATUS_WRONG_ANSWER]: 'WRONG_ANSWER',
[STATUS.STATUS_ACCEPTED]: 'CORRECT',
@@ -35,7 +24,6 @@ const status = {
};
export async function apply(ctx: Context) {
ctx.Route('board_xcpcio', '/board', XcpcioHandler);
ctx.inject(['scoreboard'], ({ scoreboard }) => {
scoreboard.addView('xcpcio', 'XCPCIO', {
tdoc: 'tdoc',
+1 -1
View File
@@ -185,7 +185,7 @@ class VJudgeService extends Service {
super(ctx, 'vjudge');
}
accounts: RemoteAccount[];
accounts: RemoteAccount[] = [];
private providers: Record<string, any> = {};
private pool: Record<string, AccountService> = {};
async [Service.setup]() {