core: fix validation

This commit is contained in:
undefined committed 2023-04-08 16:15:04 +08:00
1 parent 7e7a714b02
commit bf33ffa640
3 files changed
+18 -14

No files matched your search

+11 -11
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "4.9.11", "version": "4.9.12",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/plugin-api", "main": "src/plugin-api",
"module": "src/plugin-api", "module": "src/plugin-api",
@@ -12,11 +12,11 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.290.0", "@aws-sdk/client-s3": "^3.306.0",
"@aws-sdk/lib-storage": "^3.290.0", "@aws-sdk/lib-storage": "^3.306.0",
"@aws-sdk/middleware-endpoint": "^3.290.0", "@aws-sdk/middleware-endpoint": "^3.306.0",
"@aws-sdk/s3-presigned-post": "^3.290.0", "@aws-sdk/s3-presigned-post": "^3.306.0",
"@aws-sdk/s3-request-presigner": "^3.290.0", "@aws-sdk/s3-request-presigner": "^3.306.0",
"@graphql-tools/schema": "^9.0.17", "@graphql-tools/schema": "^9.0.17",
"@hydrooj/utils": "workspace:*", "@hydrooj/utils": "workspace:*",
"@simplewebauthn/server": "^7.2.0", "@simplewebauthn/server": "^7.2.0",
@@ -39,9 +39,9 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"lru-cache": "7.14.1", "lru-cache": "7.14.1",
"mime-types": "^2.1.35", "mime-types": "^2.1.35",
"moment-timezone": "^0.5.41", "moment-timezone": "^0.5.43",
"mongodb": "^5.1.0", "mongodb": "^5.2.0",
"nanoid": "^4.0.1", "nanoid": "^4.0.2",
"nodemailer": "^6.9.1", "nodemailer": "^6.9.1",
"notp": "^2.0.3", "notp": "^2.0.3",
"p-queue": "^7.3.4", "p-queue": "^7.3.4",
@@ -60,11 +60,11 @@
"@types/adm-zip": "^0.4.34", "@types/adm-zip": "^0.4.34",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.1",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/koa": "^2.13.5", "@types/koa": "^2.13.6",
"@types/koa-compress": "^4.0.3", "@types/koa-compress": "^4.0.3",
"@types/koa-router": "^7.4.4", "@types/koa-router": "^7.4.4",
"@types/koa-static-cache": "^5.1.1", "@types/koa-static-cache": "^5.1.1",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.192",
"@types/mime-types": "^2.1.1", "@types/mime-types": "^2.1.1",
"@types/nodemailer": "^6.4.7", "@types/nodemailer": "^6.4.7",
"@types/notp": "^2.0.2", "@types/notp": "^2.0.2",
+2 -1
View File
@@ -1,4 +1,5 @@
import child from 'child_process'; import child from 'child_process';
import path from 'path';
import { CAC } from 'cac'; import { CAC } from 'cac';
import fs from 'fs-extra'; import fs from 'fs-extra';
import superagent from 'superagent'; import superagent from 'superagent';
@@ -17,7 +18,7 @@ export function register(cli: CAC) {
const res = await superagent.get(patch); const res = await superagent.get(patch);
logger.info('Downloaded patch'); logger.info('Downloaded patch');
for (let i = 0; i <= 100; i++) { for (let i = 0; i <= 100; i++) {
const fp = `${mod}.${i}.patch`; const fp = path.join(path.dirname(mod), `${mod}.${i}.patch`);
if (fs.existsSync(fp)) continue; if (fs.existsSync(fp)) continue;
patch = fp; patch = fp;
break; break;
+5 -2
View File
@@ -574,8 +574,11 @@ const scripts: UpgradeScript[] = [
return await iterateAllDomain(async ({ _id }) => { return await iterateAllDomain(async ({ _id }) => {
const cursor = discussion.getMulti(_id, { parentType: document.TYPE_CONTEST }); const cursor = discussion.getMulti(_id, { parentType: document.TYPE_CONTEST });
for await (const ddoc of cursor) { for await (const ddoc of cursor) {
const tdoc = await contest.get(_id, ddoc.parentId as ObjectId); try {
if (!tdoc) await discussion.del(_id, ddoc.docId); await contest.get(_id, ddoc.parentId as ObjectId);
} catch (e) {
await discussion.del(_id, ddoc.docId);
}
} }
}); });
}, },