mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 01:08:41 +00:00
chore(remote_judger): prevent multiple request in ensureLogin()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d824955ebe
commit
c2fdca91cd
@ -148,7 +148,7 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getCsrfToken(url: string, referer = '') {
|
async getCsrfToken(url: string, referer = '') {
|
||||||
const { text: html } = await this.get(url).set('Referer', referer);
|
const { text: html, header } = await this.get(url).set('Referer', referer);
|
||||||
const {
|
const {
|
||||||
window: { document },
|
window: { document },
|
||||||
} = new JSDOM(html);
|
} = new JSDOM(html);
|
||||||
@ -164,6 +164,7 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
)?.getAttribute('content'),
|
)?.getAttribute('content'),
|
||||||
ftaa,
|
ftaa,
|
||||||
bfaa,
|
bfaa,
|
||||||
|
header,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,8 +199,7 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
|
|
||||||
if (!this.account.handle) return false;
|
if (!this.account.handle) return false;
|
||||||
|
|
||||||
const [csrf, ftaa, bfaa] = await this.getCsrfToken('/enter');
|
const [csrf, ftaa, bfaa, header] = await this.getCsrfToken('/enter');
|
||||||
const { header } = await this.get('/enter');
|
|
||||||
|
|
||||||
if (header['set-cookie']) {
|
if (header['set-cookie']) {
|
||||||
this.cookie = header['set-cookie'];
|
this.cookie = header['set-cookie'];
|
||||||
|
Loading…
Reference in New Issue
Block a user