mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-22 03:21:52 +00:00
feat(remote_judger): submitProblem status report
This commit is contained in:
parent
10ee5ca049
commit
36ff691a04
@ -205,6 +205,8 @@ export default class AtcoderProvider implements IBasicProvider {
|
||||
`(S2OJ Submission #${submissionId})`
|
||||
);
|
||||
|
||||
await next({ status: 'Submitting to AtCoder...' });
|
||||
|
||||
// TODO: check submit time to ensure submission
|
||||
const res = await this.post(`/contests/${contestId}/submit`).send({
|
||||
csrf_token: csrf,
|
||||
@ -227,6 +229,8 @@ export default class AtcoderProvider implements IBasicProvider {
|
||||
this.cookie = res.header['set-cookie'];
|
||||
}
|
||||
|
||||
await next({ status: 'Submitted to AtCoder' });
|
||||
|
||||
const { text: status, header: status_header } = await this.get(
|
||||
`/contests/${contestId}/submissions/me`
|
||||
).retry(3);
|
||||
@ -280,7 +284,7 @@ export default class AtcoderProvider implements IBasicProvider {
|
||||
statusElem.title === 'Waiting for Re-judging' ||
|
||||
['WJ', 'WR'].includes(statusElem.innerHTML.trim())
|
||||
) {
|
||||
await next({ test_id: 0 });
|
||||
await next({ status: '[AtCoder] Waiting for Judging' });
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -277,6 +277,8 @@ export default class CodeforcesProvider implements IBasicProvider {
|
||||
`(S2OJ Submission #${submissionId})`
|
||||
);
|
||||
|
||||
await next({ status: 'Submitting to Codeforces...' });
|
||||
|
||||
// TODO: check submit time to ensure submission
|
||||
const { text: submit, error } = await this.post(
|
||||
`/${
|
||||
@ -328,6 +330,8 @@ export default class CodeforcesProvider implements IBasicProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
await next({ status: 'Submitted to Codeforces' });
|
||||
|
||||
const { text: status } = await this.get(
|
||||
type !== 'GYM' ? '/problemset/status?my=on' : `/gym/${contestId}/my`
|
||||
).retry(3);
|
||||
@ -350,9 +354,9 @@ export default class CodeforcesProvider implements IBasicProvider {
|
||||
let count = 0;
|
||||
let fail = 0;
|
||||
|
||||
while (count < 180 && fail < 10) {
|
||||
while (count < 360 && fail < 60) {
|
||||
count++;
|
||||
await sleep(1000);
|
||||
await sleep(500);
|
||||
|
||||
try {
|
||||
const { body } = await this.post('/data/submitSource')
|
||||
|
@ -249,6 +249,8 @@ export default class LibreojProvider implements IBasicProvider {
|
||||
`(S2OJ Submission #${submissionId})`
|
||||
);
|
||||
|
||||
await next({ status: 'Submitting to LibreOJ...' });
|
||||
|
||||
const { body, error } = await this.post('/submission/submit').send({
|
||||
problemId: id,
|
||||
content: {
|
||||
@ -268,6 +270,8 @@ export default class LibreojProvider implements IBasicProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
await next({ status: 'Submitted to LibreOJ' });
|
||||
|
||||
return body.submissionId;
|
||||
}
|
||||
|
||||
@ -345,7 +349,7 @@ export default class LibreojProvider implements IBasicProvider {
|
||||
}
|
||||
|
||||
await next({
|
||||
status: `${body.progress.progressType}`,
|
||||
status: `[LibreOJ] ${body.progress.progressType}`,
|
||||
});
|
||||
|
||||
if (body.progress.progressType !== 'Finished') {
|
||||
|
@ -319,6 +319,8 @@ export default class LuoguProvider implements IBasicProvider {
|
||||
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
|
||||
}
|
||||
|
||||
await next({ status: 'Submitting to Luogu...' });
|
||||
|
||||
if (this.account.type == 'luogu-api') {
|
||||
const result = await this.post('/judge/problem').send({
|
||||
pid: id,
|
||||
|
@ -200,6 +200,8 @@ export default class QOJProvider extends UOJProvider implements IBasicProvider {
|
||||
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
|
||||
}
|
||||
|
||||
await next({ status: 'Submitting to QOJ...' });
|
||||
|
||||
const _token = await this.getCsrfToken(`/problem/${id}`);
|
||||
const { text } = await this.post(`/problem/${id}`).send({
|
||||
_token,
|
||||
|
@ -217,6 +217,8 @@ export default class UOJProvider implements IBasicProvider {
|
||||
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
|
||||
}
|
||||
|
||||
await next({ status: 'Submitting to UniversalOJ...' });
|
||||
|
||||
const _token = await this.getCsrfToken(`/problem/${id}`);
|
||||
const { text } = await this.post(`/problem/${id}`).send({
|
||||
_token,
|
||||
@ -228,6 +230,8 @@ export default class UOJProvider implements IBasicProvider {
|
||||
|
||||
if (!text.includes('我的提交记录')) throw new Error('Submit failed');
|
||||
|
||||
await next({ status: 'Submitted to UniversalOJ' });
|
||||
|
||||
const { text: status } = await this.get(
|
||||
`/submissions?problem_id=${id}&submitter=${this.account.handle}`
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user