From d9b578d56aa10deb7506ba327b1c8cb43f2a2173 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 28 May 2025 14:32:30 +0800 Subject: [PATCH] minor patches & bump deps --- framework/eslint-config/package.json | 10 +++++----- framework/framework/package.json | 5 +++-- framework/framework/server.ts | 27 ++++++++++++++------------- package.json | 14 +++++++------- packages/center/package.json | 2 +- packages/components/package.json | 8 ++++---- packages/elastic/package.json | 2 +- packages/hydrojudge/package.json | 4 ++-- packages/hydrooj/package.json | 10 +++++----- packages/hydrooj/src/context.ts | 13 ++++++++++++- packages/hydrooj/src/lib/ui.ts | 3 ++- packages/hydrooj/src/model/user.ts | 1 + packages/import-qduoj/index.ts | 5 ++++- packages/onsite-toolkit/package.json | 2 +- packages/ui-default/package.json | 22 +++++++++++----------- packages/ui-default/service-worker.ts | 1 + packages/ui-next/package.json | 8 ++++---- packages/utils/lib/utils.ts | 2 +- packages/utils/package.json | 2 +- 19 files changed, 80 insertions(+), 61 deletions(-) diff --git a/framework/eslint-config/package.json b/framework/eslint-config/package.json index d31a11efa..6420181d5 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.49.0", + "@eslint-react/eslint-plugin": "^1.50.0", "@eslint/compat": "^1.2.9", "@eslint/eslintrc": "^3.3.1", - "@stylistic/eslint-plugin": "^4.2.0", - "@typescript-eslint/eslint-plugin": "^8.32.0", - "@typescript-eslint/parser": "^8.32.0", + "@stylistic/eslint-plugin": "^4.4.0", + "@typescript-eslint/eslint-plugin": "^8.33.0", + "@typescript-eslint/parser": "^8.33.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-de-morgan": "^1.2.1", "eslint-plugin-github": "^6.0.0", @@ -18,7 +18,7 @@ "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", "eslint-plugin-simple-import-sort": "^12.1.1", - "globals": "^16.1.0" + "globals": "^16.2.0" }, "peerDependencies": { "eslint": ">= 9" diff --git a/framework/framework/package.json b/framework/framework/package.json index c4eb6eee4..0c6e0af5b 100644 --- a/framework/framework/package.json +++ b/framework/framework/package.json @@ -10,7 +10,7 @@ "@hydrooj/utils": "workspace:^", "emoji-regex": "^10.4.0", "fs-extra": "^11.3.0", - "koa": "^2.16.1", + "koa": "^3.0.0", "koa-body": "^6.0.1", "koa-compress": "^5.1.1", "koa-router": "^13.0.1", @@ -19,6 +19,7 @@ "path-to-regexp": "^8.2.0", "sanitize-filename": "^1.6.3", "saslprep": "^1.0.3", + "schemastery": "^3.16.1", "shorty.js": "^1.0.1", "ws": "^8.18.2" }, @@ -27,7 +28,7 @@ "@types/koa": "^2.15.0", "@types/koa-compress": "^4.0.6", "@types/koa-router": "^7.4.8", - "@types/lodash": "^4.17.16", + "@types/lodash": "^4.17.17", "@types/saslprep": "^1.0.3", "@types/ws": "^8.18.1" } diff --git a/framework/framework/server.ts b/framework/framework/server.ts index b2ea25063..67e5b1469 100644 --- a/framework/framework/server.ts +++ b/framework/framework/server.ts @@ -8,6 +8,7 @@ import fs from 'fs-extra'; import Koa from 'koa'; import Body from 'koa-body'; import Compress from 'koa-compress'; +import Schema from 'schemastery'; import { Shorty } from 'shorty.js'; import { WebSocket, WebSocketServer } from 'ws'; import { @@ -324,19 +325,19 @@ function executeMiddlewareStack(context: any, middlewares: { name: string, func: return dispatch(0); } -export interface WebServiceConfig { - keys: string[]; - proxy: boolean; - cors?: string; - upload?: string; - port: number; - host?: string; - xff?: string; - xhost?: string; - enableSSE?: boolean; -} - export class WebService extends Service { + static Config = Schema.object({ + keys: Schema.array(Schema.string()), + proxy: Schema.boolean(), + cors: Schema.string(), + upload: Schema.string(), + port: Schema.number(), + host: Schema.string(), + xff: Schema.string(), + xhost: Schema.string(), + enableSSE: Schema.boolean(), + }); + private registry: Record = Object.create(null); private registrationCount = Counter(); private serverLayers = []; @@ -352,7 +353,7 @@ export class WebService extends Service Handler = Handler; ConnectionHandler = ConnectionHandler; - constructor(ctx: C, public config: WebServiceConfig) { + constructor(ctx: C, public config: ReturnType) { super(ctx, 'server'); ctx.mixin('server', ['Route', 'Connection', 'withHandlerClass']); this.server.keys = this.config.keys; diff --git a/package.json b/package.json index f11c8bb26..756529656 100644 --- a/package.json +++ b/package.json @@ -43,22 +43,22 @@ "cross-env": "^7.0.3", "cross-spawn": "^7.0.6", "esbuild": "0.25.2", - "eslint": "^9.26.0", - "eslint-import-resolver-typescript": "^4.3.4", + "eslint": "^9.27.0", + "eslint-import-resolver-typescript": "^4.4.1", "eslint-import-resolver-webpack": "^0.13.10", "fs-extra": "^11.3.0", - "globals": "^16.1.0", + "globals": "^16.2.0", "globby": "~14.0.2", "inspectpack": "^4.7.1", "mongodb-memory-server": "10.1.4", "nyc": "^17.1.0", "ora": "^8.2.0", - "oxlint": "^0.16.9", + "oxlint": "^0.16.12", "package-json": "^10.0.1", - "semver": "^7.7.1", + "semver": "^7.7.2", "simple-git": "^3.27.0", - "supertest": "^7.1.0", - "supports-hyperlinks": "^3.2.0", + "supertest": "^7.1.1", + "supports-hyperlinks": "^4.1.0", "typescript": "5.8.3", "wtfnode": "^0.10.0" }, diff --git a/packages/center/package.json b/packages/center/package.json index b3b50dd78..23e36e413 100644 --- a/packages/center/package.json +++ b/packages/center/package.json @@ -11,6 +11,6 @@ }, "dependencies": { "crypto-js": "^4.2.0", - "semver": "^7.7.1" + "semver": "^7.7.2" } } diff --git a/packages/components/package.json b/packages/components/package.json index c67179e20..ecf466f31 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -4,7 +4,7 @@ "main": "./frontend/index.ts", "dependencies": { "allotment": "^1.20.3", - "diff": "^7.0.0", + "diff": "^8.0.2", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "react-dnd": "^16.0.1", @@ -13,10 +13,10 @@ "schemastery-react": "^0.1.2" }, "devDependencies": { - "@types/diff": "^7.0.2", + "@types/diff": "^8.0.0", "@types/js-yaml": "^4.0.9", - "@types/lodash": "^4.17.16", - "sass": "^1.87.0" + "@types/lodash": "^4.17.17", + "sass": "^1.89.0" }, "peerDependencies": { "react": "*", diff --git a/packages/elastic/package.json b/packages/elastic/package.json index b4dd97035..0853db243 100644 --- a/packages/elastic/package.json +++ b/packages/elastic/package.json @@ -6,7 +6,7 @@ "author": "undefined ", "license": "AGPL-3.0-or-later", "dependencies": { - "@elastic/elasticsearch": "^8.18.2" + "@elastic/elasticsearch": "^9.0.2" }, "engines": { "hydrooj": ">=5.0.0-alpha.1" diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index d96861850..208295cd9 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -8,11 +8,11 @@ "dependencies": { "@hydrooj/common": "workspace:^", "@hydrooj/utils": "workspace:^", - "@zip.js/zip.js": "^2.7.60", + "@zip.js/zip.js": "^2.7.62", "cac": "^6.7.14", "p-queue": "^8.1.0", "schemastery": "^3.16.1", - "semver": "^7.7.1", + "semver": "^7.7.2", "shell-quote": "^1.8.2", "superagent": "^10.2.1", "ws": "^8.18.2" diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 17d0a99f1..8da924777 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -23,10 +23,10 @@ "@hydrooj/utils": "workspace:^", "@simplewebauthn/server": "13.1.1", "@undefined-moe/require-resolve-hook": "^1.1.0", - "@zip.js/zip.js": "^2.7.60", + "@zip.js/zip.js": "^2.7.62", "adm-zip": "0.5.16", "cac": "^6.7.14", - "cordis": "4.0.0-beta.2", + "cordis": "4.0.0-beta.4", "csv-stringify": "^6.5.2", "emoji-regex": "^10.4.0", "emojis-list": "2.1.0", @@ -35,7 +35,7 @@ "koa-proxies": "^0.12.4", "koa-static-cache": "^5.1.4", "lodash": "^4.17.21", - "lru-cache": "^10.4.3", + "lru-cache": "^11.1.0", "mime-types": "^3.0.1", "moment-timezone": "^0.5.48", "mongodb": "^6.16.0", @@ -47,7 +47,7 @@ "sanitize-filename": "^1.6.3", "saslprep": "^1.0.3", "schemastery": "^3.16.1", - "semver": "^7.7.1", + "semver": "^7.7.2", "shorty.js": "^1.0.1", "superagent": "^10.2.1", "tar": "6.2.1", @@ -60,7 +60,7 @@ "@types/fs-extra": "^11.0.4", "@types/js-yaml": "^4.0.9", "@types/koa-static-cache": "^5.1.4", - "@types/lodash": "^4.17.16", + "@types/lodash": "^4.17.17", "@types/mime-types": "^2.1.4", "@types/mongodb-uri": "^0.9.4", "@types/nodemailer": "^6.4.17", diff --git a/packages/hydrooj/src/context.ts b/packages/hydrooj/src/context.ts index cdbfc6e1f..0433a3211 100644 --- a/packages/hydrooj/src/context.ts +++ b/packages/hydrooj/src/context.ts @@ -71,6 +71,17 @@ export class Context extends cordis.Context { super(); this.plugin(ApiMixin); this.plugin(TimerService); - this.plugin(LoggerService); + this.plugin(LoggerService, { + console: { + showDiff: false, + showTime: 'dd hh:mm:ss', + label: { + align: 'right', + width: 9, + margin: 1, + }, + levels: { default: process.env.DEV ? 3 : 2 }, + }, + }); } } diff --git a/packages/hydrooj/src/lib/ui.ts b/packages/hydrooj/src/lib/ui.ts index 741822ce3..9d3e61fd6 100644 --- a/packages/hydrooj/src/lib/ui.ts +++ b/packages/hydrooj/src/lib/ui.ts @@ -54,7 +54,8 @@ inject('Nav', 'record_main', { query: (handler) => (handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) ? ({ uidOrName: handler.user._id }) : ({})), -}); +}, (handler) => (handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) + ? true : handler.user.hasPerm(PERM.PERM_VIEW_RECORD))); inject('Nav', 'ranking', { prefix: 'ranking' }, PERM.PERM_VIEW_RANKING); inject('Nav', 'domain_dashboard', { prefix: 'domain' }, PERM.PERM_EDIT_DOMAIN); inject('Nav', 'manage_dashboard', { prefix: 'manage' }, PRIV.PRIV_EDIT_SYSTEM); diff --git a/packages/hydrooj/src/model/user.ts b/packages/hydrooj/src/model/user.ts index fb2a0f048..6049eb529 100644 --- a/packages/hydrooj/src/model/user.ts +++ b/packages/hydrooj/src/model/user.ts @@ -189,6 +189,7 @@ async function initAndCache(udoc: Udoc, dudoc, scope: bigint = PERM.PERM_ALL) { class UserModel { static coll = coll; + static collGroup = collGroup; static User = User; static cache = cache; static defaultUser: Udoc = { diff --git a/packages/import-qduoj/index.ts b/packages/import-qduoj/index.ts index 6ace605d9..2dbe3ffb8 100644 --- a/packages/import-qduoj/index.ts +++ b/packages/import-qduoj/index.ts @@ -26,7 +26,10 @@ const ProblemSchema = Schema.object({ })), hint: StringValue, source: Schema.union([StringValue, Schema.string()]), - display_id: Schema.string(), + display_id: Schema.transform( + Schema.union([Schema.number(), Schema.string()]), + (value) => (typeof value === 'number' ? `P${value.toString()}` : value), + ), time_limit: Schema.union([Schema.number(), Schema.string()]).required(), memory_limit: Schema.union([Schema.number(), Schema.string()]).required(), spj: Schema.union([ diff --git a/packages/onsite-toolkit/package.json b/packages/onsite-toolkit/package.json index 5fc7bac74..b25a99ee7 100644 --- a/packages/onsite-toolkit/package.json +++ b/packages/onsite-toolkit/package.json @@ -2,7 +2,7 @@ "name": "@hydrooj/onsite-toolkit", "version": "0.1.0-beta.1", "dependencies": { - "@react-spring/web": "^9.7.5", + "@react-spring/web": "^10.0.1", "react-use": "^17.6.0" } } diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 3e4efe31a..fc2949ecc 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -21,8 +21,8 @@ "@fontsource/source-code-pro": "^5.2.5", "@fontsource/ubuntu-mono": "^5.2.5", "@hydrooj/utils": "workspace:^", - "@sentry/browser": "^9.17.0", - "@sentry/webpack-plugin": "^3.4.0", + "@sentry/browser": "^9.22.0", + "@sentry/webpack-plugin": "^3.5.0", "@simplewebauthn/browser": "13.1.0", "@svgr/webpack": "^8.1.0", "@types/html-to-text": "^9.0.4", @@ -34,8 +34,8 @@ "@types/nunjucks": "^3.2.6", "@types/pickadate": "^3.5.35", "@types/qrcode": "^1.5.5", - "@types/react": "^19.1.3", - "@types/react-dom": "^19.1.3", + "@types/react": "^19.1.6", + "@types/react-dom": "^19.1.5", "@types/redux-logger": "^3.0.13", "@types/uuid": "^10.0.0", "@types/webpack-env": "^1.18.8", @@ -49,12 +49,12 @@ "clean-webpack-plugin": "^4.0.0", "clipboard": "^2.0.11", "copy-webpack-plugin": "^13.0.0", - "cordis": "4.0.0-beta.2", + "cordis": "4.0.0-beta.4", "core-js": "^3.42.0", "core-js-compat": "^3.42.0", "css-loader": "^7.1.2", - "diff": "^7.0.0", - "diff-dom": "^5.1.4", + "diff": "^8.0.2", + "diff-dom": "^5.2.0", "echarts": "^5.6.0", "emojis-keywords": "2.0.0", "emojis-list": "2.1.0", @@ -66,7 +66,7 @@ "jquery.easing": "^1.4.1", "jquery.transit": "^0.9.12", "matchmedia-polyfill": "^0.3.2", - "md-editor-rt": "^5.5.1", + "md-editor-rt": "^5.6.0", "mini-css-extract-plugin": "^2.9.2", "moment": "^2.30.1", "monaco-editor": "0.52.2", @@ -98,7 +98,7 @@ "redux-promise-middleware": "^6.2.0", "redux-thunk": "^3.1.0", "rupture": "^0.7.1", - "sass": "^1.87.0", + "sass": "^1.89.0", "sass-loader": "^16.0.5", "schemastery": "^3.16.1", "schemastery-react": "^0.1.2", @@ -115,7 +115,7 @@ "timeago.js": "^4.0.2", "ts-loader": "^9.5.2", "web-streams-polyfill": "^4.1.0", - "webpack": "^5.99.8", + "webpack": "^5.99.9", "webpack-bundle-analyzer": "^4.10.2", "webpack-dev-server": "^5.2.1", "webpack-manifest-plugin": "^5.0.1", @@ -123,7 +123,7 @@ }, "dependencies": { "@hydrooj/common": "workspace:^", - "ansi_up": "^6.0.5", + "ansi_up": "^6.0.6", "cssfilter": "^0.0.11", "esbuild": "0.25.2", "fs-extra": "^11.3.0", diff --git a/packages/ui-default/service-worker.ts b/packages/ui-default/service-worker.ts index 9de66a695..37c112ff8 100644 --- a/packages/ui-default/service-worker.ts +++ b/packages/ui-default/service-worker.ts @@ -95,6 +95,7 @@ function shouldCachePath(path: string) { if (!path.split('?')[0].split('/').pop()) return false; if (!path.split('?')[0].split('/').pop().includes('.')) return false; if (process.env.NODE_ENV !== 'production' && (path.includes('.hot-update.') || path.includes('?version='))) return false; + if (path.includes('?v=')) return false; return true; } function shouldCache(request: Request) { diff --git a/packages/ui-next/package.json b/packages/ui-next/package.json index d0aa000dd..7ae386721 100644 --- a/packages/ui-next/package.json +++ b/packages/ui-next/package.json @@ -8,14 +8,14 @@ "preview": "vite preview" }, "dependencies": { - "@vitejs/plugin-react": "^4.4.1", + "@vitejs/plugin-react": "^4.5.0", "react": "^18.3.1", "react-dom": "^18.3.1" }, "devDependencies": { - "@types/react": "^19.1.3", - "@types/react-dom": "^19.1.3", - "@vitejs/plugin-react-swc": "^3.9.0", + "@types/react": "^19.1.6", + "@types/react-dom": "^19.1.5", + "@vitejs/plugin-react-swc": "^3.10.0", "vite": "^6.3.5" } } diff --git a/packages/utils/lib/utils.ts b/packages/utils/lib/utils.ts index d8b308c99..ff4ae3427 100644 --- a/packages/utils/lib/utils.ts +++ b/packages/utils/lib/utils.ts @@ -25,8 +25,8 @@ factory.addExporter(new Exporter.Console({ margin: 1, }, timestamp: Date.now(), + levels: { default: process.env.DEV ? 3 : 2 }, })); -factory.exporters.get(1).levels = { default: process.env.DEV ? 3 : 2 }; function createLogger(name: string) { return factory.createLogger(name); diff --git a/packages/utils/package.json b/packages/utils/package.json index d6ff7c435..a583ee0e1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -16,7 +16,7 @@ "mongodb": "^6.16.0", "reggol": "^2.1.0", "search-query-parser": "^1.6.0", - "systeminformation": "^5.25.11" + "systeminformation": "^5.27.1" }, "devDependencies": { "@types/fs-extra": "^11.0.4"