From 71eceaa304ca6dfe2eb605eac7263909257a7290 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 16 Apr 2025 10:10:04 +0800 Subject: [PATCH] bug fixes --- README.md | 1 + framework/eslint-config/package.json | 6 +++--- packages/hydrojudge/vendor/testlib | 2 +- packages/hydrooj/package.json | 3 +-- packages/hydrooj/src/context.ts | 4 ++-- packages/onsite-toolkit/index.ts | 23 ++++++++++++----------- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index f4ac7f752..05fa87d39 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ Hydro 用户群:1085853538 - core: oauth: 改为使用 ctx.oauth.provide() 注册 - framework: 移除 ready 与 dispose 事件 (使用 ctx.effect 代替) - core: 最低要求 node 22 +- core: 弃用 AdmZip ## Hydro 4.19.0 / UI 4.57.0 diff --git a/framework/eslint-config/package.json b/framework/eslint-config/package.json index e94632a49..f11e87e02 100644 --- a/framework/eslint-config/package.json +++ b/framework/eslint-config/package.json @@ -4,12 +4,12 @@ "license": "MIT", "main": "base.mjs", "dependencies": { - "@eslint-react/eslint-plugin": "^1.47.2", + "@eslint-react/eslint-plugin": "^1.47.4", "@eslint/compat": "^1.2.8", "@eslint/eslintrc": "^3.3.1", "@stylistic/eslint-plugin": "^4.2.0", - "@typescript-eslint/eslint-plugin": "^8.29.1", - "@typescript-eslint/parser": "^8.29.1", + "@typescript-eslint/eslint-plugin": "^8.30.1", + "@typescript-eslint/parser": "^8.30.1", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-de-morgan": "^1.2.1", "eslint-plugin-github": "^6.0.0", diff --git a/packages/hydrojudge/vendor/testlib b/packages/hydrojudge/vendor/testlib index d0a0161b2..9ecb11126 160000 --- a/packages/hydrojudge/vendor/testlib +++ b/packages/hydrojudge/vendor/testlib @@ -1 +1 @@ -Subproject commit d0a0161b20add4c973697444c586981fcd2d451b +Subproject commit 9ecb11126c16caeda2ba375e0084b3ddd03d4ace diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index e9a4640f2..ee0da0420 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -16,7 +16,7 @@ "@aws-sdk/lib-storage": "3.726.1", "@aws-sdk/s3-presigned-post": "3.726.1", "@aws-sdk/s3-request-presigner": "3.726.1", - "@cordisjs/logger": "1.0.0-alpha.5", + "@babel/code-frame": "^7.26.2", "@cordisjs/plugin-timer": "1.1.1", "@graphql-tools/schema": "^10.0.23", "@hydrooj/common": "workspace:^", @@ -58,7 +58,6 @@ "ua-parser-js": "^2.0.3" }, "devDependencies": { - "@babel/code-frame": "^7.26.2", "@types/adm-zip": "^0.5.7", "@types/babel__code-frame": "^7.0.6", "@types/fs-extra": "^11.0.4", diff --git a/packages/hydrooj/src/context.ts b/packages/hydrooj/src/context.ts index 0877f55de..cdbfc6e1f 100644 --- a/packages/hydrooj/src/context.ts +++ b/packages/hydrooj/src/context.ts @@ -1,4 +1,4 @@ -import LoggerService from '@cordisjs/logger'; +import LoggerService from '@cordisjs/plugin-logger'; import { TimerService } from '@cordisjs/plugin-timer'; import * as cordis from 'cordis'; import Schema from 'schemastery'; @@ -18,7 +18,7 @@ function addScript(name: string, description: string, validate: Schema, ru } function provideModule(type: T, id: string, module: ModuleInterfaces[T]) { - if (global.Hydro.module[type][id]) throw new Error(`duplicate script ${type}/${id} registered.`); + if (global.Hydro.module[type][id]) throw new Error(`duplicate module ${type}/${id} registered.`); global.Hydro.module[type as any][id] = module; return () => delete global.Hydro.module[type][id]; } diff --git a/packages/onsite-toolkit/index.ts b/packages/onsite-toolkit/index.ts index 7706914e1..911f3e80e 100644 --- a/packages/onsite-toolkit/index.ts +++ b/packages/onsite-toolkit/index.ts @@ -249,17 +249,18 @@ export function apply(ctx: Context) { }), ]; const zip = new Zip.ZipWriter(new Zip.BlobWriter()); - await zip.add('event-feed.ndjson', new Zip.TextReader(eventfeed.concat(submissions).concat(endState).map((i) => JSON.stringify(i)).join('\n'))); - await zip.add('contest/logo.png', new Zip.BlobReader(new Blob([fs.readFileSync(findFileSync('@hydrooj/onsite-toolkit/public/logo.png'))]))); - for (const i of ['teams', 'organizations']) { - zip.add(`${i}/`, null, { directory: true }); - } - for (const i of teams) { - zip.add(`teams/${i.team_id}/photo.download.txt`, new Zip.TextReader(i.avatar)); - } - for (const i of organizations) { - zip.add(`organizations/${orgId[i]}/photo.download.txt`, new Zip.TextReader(avatar(teams.find((j) => j.organization === i)?.avatar || 'no photo, find and download it yourself'))); - } + await Promise.all([ + zip.add('event-feed.ndjson', new Zip.TextReader(eventfeed.concat(submissions).concat(endState).map((i) => JSON.stringify(i)).join('\n'))), + zip.add('contest/logo.png', new Zip.BlobReader(new Blob([fs.readFileSync(findFileSync('@hydrooj/onsite-toolkit/public/logo.png'))]))), + zip.add('teams/', null, { directory: true }), + zip.add('organizations/', null, { directory: true }), + ]); + await Promise.all(teams.map(async (i) => { + await zip.add(`teams/${i.team_id}/photo.download.txt`, new Zip.TextReader(i.avatar)); + })); + await Promise.all(organizations.map(async (i) => { + await zip.add(`organizations/${orgId[i]}/photo.download.txt`, new Zip.TextReader(avatar(teams.find((j) => j.organization === i)?.avatar || 'no photo, find and download it yourself'))); + })); this.binary(await zip.close(), `contest-${tdoc._id}-cdp.zip`); }, supportedRules: ['acm'],