mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: remove /nix path prefix
This commit is contained in:
1 parent
6bda0e58d3
commit
ad050ba1fb
3 files changed
+11
-3
No files matched your search
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
"@types/autocannon": "^7.6.1",
|
"@types/autocannon": "^7.6.1",
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/mocha": "^9.1.1",
|
"@types/mocha": "^9.1.1",
|
||||||
"@types/node": "^18.6.4",
|
"@types/node": "^18.6.5",
|
||||||
"@types/semver": "^7.3.10",
|
"@types/semver": "^7.3.10",
|
||||||
"@types/supertest": "^2.0.12",
|
"@types/supertest": "^2.0.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.22.7",
|
"version": "2.22.8",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ import {
|
|||||||
|
|
||||||
const argv = cac().parse();
|
const argv = cac().parse();
|
||||||
|
|
||||||
|
function removeNixPath(text: string) {
|
||||||
|
return text.replace(/\/nix\/store\/[a-z0-9]{32}-/g, '/nix/');
|
||||||
|
}
|
||||||
|
|
||||||
class JudgeTask {
|
class JudgeTask {
|
||||||
stat: Record<string, Date>;
|
stat: Record<string, Date>;
|
||||||
session: any;
|
session: any;
|
||||||
@@ -137,7 +141,9 @@ class JudgeTask {
|
|||||||
log.debug('Next: %d %o', data);
|
log.debug('Next: %d %o', data);
|
||||||
data.key = 'next';
|
data.key = 'next';
|
||||||
data.rid = new ObjectID(this.rid);
|
data.rid = new ObjectID(this.rid);
|
||||||
if (data.case) data.case.message ||= '';
|
if (data.case) data.case.message = removeNixPath(data.case.message || '');
|
||||||
|
if (typeof data.message === 'string') data.message = removeNixPath(data.message);
|
||||||
|
if (typeof data.compilerText === 'string') data.compilerText = removeNixPath(data.compilerText);
|
||||||
this.ws.send(JSON.stringify(data));
|
this.ws.send(JSON.stringify(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +151,8 @@ class JudgeTask {
|
|||||||
log.info('End: %o', data);
|
log.info('End: %o', data);
|
||||||
data.key = 'end';
|
data.key = 'end';
|
||||||
data.rid = this.request.rid;
|
data.rid = this.request.rid;
|
||||||
|
if (typeof data.message === 'string') data.message = removeNixPath(data.message);
|
||||||
|
if (typeof data.compilerText === 'string') data.compilerText = removeNixPath(data.compilerText);
|
||||||
this.ws.send(JSON.stringify(data));
|
this.ws.send(JSON.stringify(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user