vjudge: codeforces: handle redirect

This commit is contained in:
undefined committed 2021-06-21 21:34:59 +08:00
1 parent 208f23082a
commit c9d4eb3d1f
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/vjudge",
"version": "1.0.7",
"version": "1.0.8",
"description": "Submit problems to remote oj",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
+2 -2
View File
@@ -100,7 +100,7 @@ export default class CodeforcesProvider implements IBasicProvider {
async getProblem(id: string) {
logger.info(id);
const [, contestId, problemId] = id.startsWith('P921')
? ['', '921', id.split('P921')[1]]
? ['', '921', '01']
: /^P(\d+)([A-Z][0-9]?)$/.exec(id);
const res = await this.get(`/problemset/problem/${contestId}/${problemId}`);
if (!res.text) return null;
@@ -139,7 +139,7 @@ export default class CodeforcesProvider implements IBasicProvider {
});
const description = document.body.innerHTML.trim();
return {
title,
title: id.startsWith('P921') ? title.replace('1', id.split('P921')[1]) : title,
data: {
'config.yaml': Buffer.from(`time: ${time}s\nmemory: ${memory}m\ntype: remote_judge\nsubType: codeforces\ntarget: ${id}`),
},