mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-23 13:08:40 +00:00
fix(remote_judger/atcoder): add referer when submitting problem
This commit is contained in:
parent
70d5b541de
commit
afda9290fa
@ -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