mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: fix codeforces result fetch (picked from #599)
This commit is contained in:
1 file changed
+7
-3
@@ -302,7 +302,8 @@ export default class CodeforcesProvider extends BasicFetcher implements IBasicPr
|
||||
? '/problemset/status?my=on'
|
||||
: `/gym/${contestId}/my`);
|
||||
this.csrf = document.querySelector('meta[name="X-Csrf-Token"]').getAttribute('content');
|
||||
return document.querySelector('[data-submission-id]').getAttribute('data-submission-id');
|
||||
const submission = document.querySelector('[data-submission-id]').getAttribute('data-submission-id');
|
||||
return type !== 'GYM' ? submission : `${contestId}#${submission}`;
|
||||
}
|
||||
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
@@ -310,9 +311,12 @@ export default class CodeforcesProvider extends BasicFetcher implements IBasicPr
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
await sleep(3000);
|
||||
const { body } = await this.post('/data/submitSource').send({
|
||||
const contestId = id.includes('#') ? id.split('#')[0] : null;
|
||||
const { body } = await this.post('/data/submitSource')
|
||||
.set('referer', contestId ? `https://codeforces.com/gym/${contestId}/my` : 'https://codeforces.com/problemset/status?my=on')
|
||||
.send({
|
||||
csrf_token: this.csrf,
|
||||
submissionId: id,
|
||||
submissionId: contestId ? id.split('#')[1] : id,
|
||||
});
|
||||
if (body.compilationError === 'true') {
|
||||
return await end({
|
||||
|
||||
Reference in new issue
Block a user