From 1c7243cd84f5de5f2c443788bca0529df881403c Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 17 Apr 2023 13:24:39 +0800 Subject: [PATCH] vjudge: hustoj: add submit failure notice --- packages/vjudge/src/providers/hustoj.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vjudge/src/providers/hustoj.ts b/packages/vjudge/src/providers/hustoj.ts index 53b3992d2..14fe0229e 100644 --- a/packages/vjudge/src/providers/hustoj.ts +++ b/packages/vjudge/src/providers/hustoj.ts @@ -160,7 +160,7 @@ export class HUSTOJ extends BasicFetcher implements IBasicProvider { return this.loggedIn; } - async submitProblem(id: string, lang: string, code: string) { + async submitProblem(id: string, lang: string, code: string, info, next, end) { await this.ensureLogin(); if (id.startsWith('P')) id = id.substring(1); const res = await this.post(this.config.submit.endpoint).send({ @@ -172,7 +172,12 @@ export class HUSTOJ extends BasicFetcher implements IBasicProvider { // if (res.text.includes(this.config.submit.tooFrequent)) throw new TooFrequentError(); console.log(res.text); if (this.config.submit.noRefetch) { - return res.text.match(this.config.submit.rid)[0].split('=')[1]; + const match = res.text.match(this.config.submit.rid); + if (!match?.length) { + end({ message: res.text.substring(0, 1024) }); + return null; + } + return match[0].split('=')[1]; } const url = this.config.monit.endpoint.replace('{uid}', this.state.username).replace('{pid}', id); this.state.pid = id;