mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
vjudge: throw error when codeforces not available
This commit is contained in:
1 parent
3f2c6625a2
commit
69f84b4a28
2 files changed
+5
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/vjudge",
|
||||
"version": "1.3.8",
|
||||
"version": "1.3.9",
|
||||
"description": "Submit problems to remote oj",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsdom": "^16.2.13",
|
||||
"@types/lodash": "^4.14.173",
|
||||
"@types/lodash": "^4.14.174",
|
||||
"@types/superagent": "^4.1.13",
|
||||
"@types/superagent-proxy": "^2.0.1"
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ export default class CodeforcesProvider implements IBasicProvider {
|
||||
this.cookie = header['set-cookie'];
|
||||
}
|
||||
const $dom = new JSDOM(html);
|
||||
if ($dom.window.document.body.children.length < 2 && html.length < 1000) {
|
||||
throw new Error($dom.window.document.body.textContent);
|
||||
}
|
||||
return $dom.window.document.querySelector('meta[name="X-Csrf-Token"]').getAttribute('content');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user