mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
vjudge: fix set-cookie
This commit is contained in:
1 parent
0a11be95da
commit
10603d9602
2 files changed
+6
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/vjudge",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Submit problems to remote oj",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -56,7 +56,11 @@ export default class CodeforcesProvider implements IBasicProvider {
|
||||
}
|
||||
|
||||
async getCsrfToken(url: string) {
|
||||
const { text: html } = await this.get(url);
|
||||
const { text: html, header } = await this.get(url);
|
||||
if (header['set-cookie']) {
|
||||
await this.save({ cookie: header['set-cookie'] });
|
||||
this.cookie = header['set-cookie'];
|
||||
}
|
||||
const $dom = new JSDOM(html);
|
||||
return $dom.window.document.querySelector('meta[name="X-Csrf-Token"]').getAttribute('content');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user