core: 比赛时自动隐藏题目标签

pull/156/head
undefined 3 years ago
parent 2b52930e9a
commit 2cc2c88b8a

@ -31,14 +31,14 @@
"@shelf/jest-mongodb": "^1.2.5", "@shelf/jest-mongodb": "^1.2.5",
"@types/cross-spawn": "^6.0.2", "@types/cross-spawn": "^6.0.2",
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",
"@types/node": "^15.12.0", "@types/node": "^15.12.2",
"@types/semver": "^7.3.6", "@types/semver": "^7.3.6",
"@typescript-eslint/eslint-plugin": "^4.26.0", "@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.0", "@typescript-eslint/parser": "^4.26.1",
"cac": "^6.7.3", "cac": "^6.7.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"eslint": "^7.27.0", "eslint": "^7.28.0",
"eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-airbnb-typescript": "^12.3.1",
"eslint-import-resolver-typescript": "^2.4.0", "eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.23.4", "eslint-plugin-import": "^2.23.4",
@ -48,9 +48,9 @@
"latest-version": "^5.1.0", "latest-version": "^5.1.0",
"mongodb": "^3.6.9", "mongodb": "^3.6.9",
"nmls": "^3.0.1", "nmls": "^3.0.1",
"ora": "^5.4.0", "ora": "^5.4.1",
"semver": "^7.3.5", "semver": "^7.3.5",
"ts-jest": "^27.0.2", "ts-jest": "^27.0.3",
"typedoc": "^0.20.36", "typedoc": "^0.20.36",
"typescript": "4.2.4" "typescript": "4.2.4"
} }

@ -12,7 +12,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/js-yaml": "^4.0.1", "@types/js-yaml": "^4.0.1",
"@types/node": "^15.12.0" "@types/node": "^15.12.2"
}, },
"peerDependencies": { "peerDependencies": {
"hydrooj": "*" "hydrooj": "*"

@ -48,7 +48,14 @@ if (!cluster.isMaster) {
const arg1 = argv.args[1]; const arg1 = argv.args[1];
const arg2 = argv.args[2]; const arg2 = argv.args[2];
if (operation === 'addon') { if (operation === 'addon') {
if (arg1 === 'add') addons.push(arg2); if (arg1 === 'create') {
fs.mkdirSync('/root/addon');
child.execSync('yarn init -y', { cwd: '/root/addon' });
fs.mkdirSync('/root/addon/templates');
fs.mkdirSync('/root/addon/locales');
fs.mkdirSync('/root/addon/public');
addons.push('/root/addon');
} else if (arg1 === 'add') addons.push(arg2);
else if (arg1 === 'remove') { else if (arg1 === 'remove') {
for (let i = 0; i < addons.length; i++) { for (let i = 0; i < addons.length; i++) {
if (addons[i] === arg2) { if (addons[i] === arg2) {

@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.28.24", "version": "2.28.25",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",

@ -76,6 +76,7 @@ export class ContestDetailHandler extends Handler {
]; ];
const index = tdoc.pids.map((i) => i.toString()); const index = tdoc.pids.map((i) => i.toString());
for (const key in pdict) { for (const key in pdict) {
pdict[key].tag.length = 0;
const i = (index.indexOf(key) + 10).toString(36).toUpperCase(); const i = (index.indexOf(key) + 10).toString(36).toUpperCase();
if (i !== '9') pdict[key].pid = i; if (i !== '9') pdict[key].pid = i;
} }
@ -265,6 +266,7 @@ export class ContestProblemHandler extends Handler {
]); ]);
if (!this.pdoc) throw new ProblemNotFoundError(domainId, pid); if (!this.pdoc) throw new ProblemNotFoundError(domainId, pid);
this.pdoc.pid = _pid; this.pdoc.pid = _pid;
this.pdoc.tag.length = 0;
// @ts-ignore // @ts-ignore
if (this.pdoc.domainId !== domainId) this.pdoc.docId = `${this.pdoc.domainId}:${this.pdoc.docId}`; if (this.pdoc.domainId !== domainId) this.pdoc.docId = `${this.pdoc.domainId}:${this.pdoc.docId}`;
this.attended = this.tsdoc && this.tsdoc.attend === 1; this.attended = this.tsdoc && this.tsdoc.attend === 1;

@ -39,9 +39,9 @@
"copy-webpack-plugin": "^6.4.1", "copy-webpack-plugin": "^6.4.1",
"css-loader": "^4.3.0", "css-loader": "^4.3.0",
"diff-dom": "^4.2.2", "diff-dom": "^4.2.2",
"echarts": "^5.1.1", "echarts": "^5.1.2",
"emojify.js": "^1.1.0", "emojify.js": "^1.1.0",
"eslint": "^7.27.0", "eslint": "^7.28.0",
"eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb": "^18.2.1",
"eslint-import-resolver-webpack": "^0.13.1", "eslint-import-resolver-webpack": "^0.13.1",
"eslint-plugin-babel": "^5.3.1", "eslint-plugin-babel": "^5.3.1",

@ -16,7 +16,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/fs-extra": "^9.0.11", "@types/fs-extra": "^9.0.11",
"@types/node": "^15.12.0", "@types/node": "^15.12.2",
"moment-timezone": "^0.5.33" "moment-timezone": "^0.5.33"
} }
} }

Loading…
Cancel
Save