judge: fix testcase matching for inputX.txt

This commit is contained in:
undefined committed 2022-03-23 16:24:58 +08:00
1 parent eeff671c3a
commit 1479a00cad
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.14.7", "version": "2.14.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",
+2 -2
View File
@@ -25,7 +25,7 @@ const RE0: Re0[] = [
(a) => `${a[1] + a[2]}.out`, (a) => `${a[1] + a[2]}.out`,
(a) => `${a[1] + a[2]}.ans`, (a) => `${a[1] + a[2]}.ans`,
(a) => `${a[1] + a[2]}.out`.replace(/input/g, 'output'), (a) => `${a[1] + a[2]}.out`.replace(/input/g, 'output'),
(a) => `${a[1] + a[2]}.txt`.replace(/input/g, 'output'), (a) => (a[1].includes('input') ? `${a[1] + a[2]}.txt`.replace(/input/g, 'output') : null),
], ],
id: (a) => +a[2], id: (a) => +a[2],
}, },
@@ -57,7 +57,7 @@ async function read0(folder: string, files: string[], checkFile, cfg) {
for (const func of REG.output) { for (const func of REG.output) {
if (cfg.noOutputFile) c.output = '/dev/null'; if (cfg.noOutputFile) c.output = '/dev/null';
else c.output = func(data); else c.output = func(data);
if (c.output === '/dev/null' || fs.existsSync(path.resolve(folder, c.output))) { if (c.output && (c.output === '/dev/null' || fs.existsSync(path.resolve(folder, c.output)))) {
cases.push(c); cases.push(c);
break; break;
} }
+1 -1
View File
@@ -180,7 +180,7 @@ export default class Hydro {
async init() { async init() {
await this.setCookie(this.config.cookie || ''); await this.setCookie(this.config.cookie || '');
await this.ensureLogin(); await this.ensureLogin();
setInterval(() => { this.axios.get('judge/noop'); }, 30000000); setInterval(() => { this.axios.get(''); }, 30000000); // Cookie refresh only
} }
async cacheOpen(source: string, files: any[], next?) { async cacheOpen(source: string, files: any[], next?) {