vjudge: throw error when codeforces not available

pull/222/head
undefined 3 years ago
parent 3f2c6625a2
commit 69f84b4a28

@ -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');
}

Loading…
Cancel
Save