mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: codeforces: handle redirect
This commit is contained in:
1 parent
208f23082a
commit
c9d4eb3d1f
2 files changed
+3
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/vjudge",
|
"name": "@hydrooj/vjudge",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"description": "Submit problems to remote oj",
|
"description": "Submit problems to remote oj",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
async getProblem(id: string) {
|
async getProblem(id: string) {
|
||||||
logger.info(id);
|
logger.info(id);
|
||||||
const [, contestId, problemId] = id.startsWith('P921')
|
const [, contestId, problemId] = id.startsWith('P921')
|
||||||
? ['', '921', id.split('P921')[1]]
|
? ['', '921', '01']
|
||||||
: /^P(\d+)([A-Z][0-9]?)$/.exec(id);
|
: /^P(\d+)([A-Z][0-9]?)$/.exec(id);
|
||||||
const res = await this.get(`/problemset/problem/${contestId}/${problemId}`);
|
const res = await this.get(`/problemset/problem/${contestId}/${problemId}`);
|
||||||
if (!res.text) return null;
|
if (!res.text) return null;
|
||||||
@@ -139,7 +139,7 @@ export default class CodeforcesProvider implements IBasicProvider {
|
|||||||
});
|
});
|
||||||
const description = document.body.innerHTML.trim();
|
const description = document.body.innerHTML.trim();
|
||||||
return {
|
return {
|
||||||
title,
|
title: id.startsWith('P921') ? title.replace('1', id.split('P921')[1]) : title,
|
||||||
data: {
|
data: {
|
||||||
'config.yaml': Buffer.from(`time: ${time}s\nmemory: ${memory}m\ntype: remote_judge\nsubType: codeforces\ntarget: ${id}`),
|
'config.yaml': Buffer.from(`time: ${time}s\nmemory: ${memory}m\ntype: remote_judge\nsubType: codeforces\ntarget: ${id}`),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user