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