From 018257f2b8da36cbe2da102f6b6155f480c14e15 Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 5 Feb 2023 18:44:05 +0800 Subject: [PATCH] vjudge: codeforces: fix --- packages/vjudge/src/providers/codeforces.ts | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/packages/vjudge/src/providers/codeforces.ts b/packages/vjudge/src/providers/codeforces.ts index 6cec2f97..00476f52 100644 --- a/packages/vjudge/src/providers/codeforces.ts +++ b/packages/vjudge/src/providers/codeforces.ts @@ -279,31 +279,23 @@ export default class CodeforcesProvider extends BasicFetcher implements IBasicPr else if (comment instanceof Array) code = `${comment[0]} ${msg} ${comment[1]}\n${code}`; } const [type, contestId, problemId] = parseProblemId(id); - const [csrf, ftaa, bfaa] = await this.getCsrfToken(type !== 'GYM' - ? '/problemset/submit' - : `/gym/${contestId}/submit`); - // TODO check submit time to ensure submission const endpoint = type === 'GYM' - ? `/gym/${contestId}/submit?csrf_token=${csrf}` - : `/problemset/submit/${contestId}/${problemId}?csrf_token=${csrf}`; - const { text: submit } = await this.post(endpoint).send({ + ? `/gym/${contestId}/submit` + : `/problemset/submit/${contestId}/${problemId}`; + const [csrf, ftaa, bfaa] = await this.getCsrfToken(endpoint); + // TODO check submit time to ensure submission + const { text: submit } = await this.post(`${endpoint}?csrf_token=${csrf}`).send({ csrf_token: csrf, action: 'submitSolutionFormSubmitted', programTypeId, source: code, - tabsize: 4, + tabSize: 4, sourceFile: '', ftaa, bfaa, _tta: this.tta(this.getCookie('39ce7')), - ...(type !== 'GYM') - ? { - submittedProblemCode: contestId + problemId, - sourceCodeConfirmed: true, - } : { - contestId, - submittedProblemIndex: problemId, - }, + contestId, + submittedProblemIndex: problemId, }); const { window: { document: statusDocument } } = new JSDOM(submit); const message = Array.from(statusDocument.querySelectorAll('.error'))