mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-27 15:16:21 +00:00
Compare commits
2 Commits
d627490c67
...
afda9290fa
Author | SHA1 | Date | |
---|---|---|---|
afda9290fa | |||
70d5b541de |
@ -10,23 +10,23 @@ const logger = new Logger('remote/atcoder');
|
|||||||
|
|
||||||
const LANGS_MAP = {
|
const LANGS_MAP = {
|
||||||
C: {
|
C: {
|
||||||
name: 'C (GCC 9.2.1)',
|
name: 'C (GCC 12.2.0)',
|
||||||
id: 4001,
|
id: 5017,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
'C++': {
|
'C++': {
|
||||||
name: 'C++ (GCC 9.2.1)',
|
name: 'C++ 20 (GCC 12.2.0)',
|
||||||
id: 4003,
|
id: 5001,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
Pascal: {
|
Pascal: {
|
||||||
name: 'Pascal (FPC 3.0.4)',
|
name: 'Pascal (FPC 3.2.2)',
|
||||||
id: 4041,
|
id: 5041,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
Python3: {
|
Python3: {
|
||||||
name: 'Python (3.8.2)',
|
name: 'Python (CPython 3.11.4)',
|
||||||
id: 4006,
|
id: 5055,
|
||||||
comment: '#',
|
comment: '#',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -193,9 +193,8 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [contestId, problemId] = parseProblemId(id);
|
const [contestId, problemId] = parseProblemId(id);
|
||||||
const csrf = await this.getCsrfToken(
|
const referer = `/contests/${contestId}/tasks/${problemId}`;
|
||||||
`/contests/${contestId}/tasks/${problemId}`
|
const csrf = await this.getCsrfToken(referer);
|
||||||
);
|
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'Submitting',
|
'Submitting',
|
||||||
@ -208,12 +207,14 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
await next({ status: 'Submitting to AtCoder...' });
|
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`)
|
||||||
csrf_token: csrf,
|
.set('Referer', referer)
|
||||||
'data.TaskScreenName': problemId,
|
.send({
|
||||||
'data.LanguageId': programType.id,
|
'data.TaskScreenName': problemId,
|
||||||
sourceCode: code,
|
'data.LanguageId': programType.id,
|
||||||
});
|
sourceCode: code,
|
||||||
|
csrf_token: csrf,
|
||||||
|
});
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
await end({
|
await end({
|
||||||
@ -233,7 +234,9 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
|
|
||||||
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);
|
)
|
||||||
|
.set('Referer', referer)
|
||||||
|
.retry(3);
|
||||||
|
|
||||||
if (status_header['set-cookie']) {
|
if (status_header['set-cookie']) {
|
||||||
this.cookie = status_header['set-cookie'];
|
this.cookie = status_header['set-cookie'];
|
||||||
|
Loading…
Reference in New Issue
Block a user