mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: luogu: o2
This commit is contained in:
1 parent
0a91d45849
commit
7101a3096c
2 files changed
+11
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/vjudge",
|
"name": "@hydrooj/vjudge",
|
||||||
"version": "1.5.0-next.5",
|
"version": "1.5.0-next.6",
|
||||||
"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",
|
||||||
|
|||||||
@@ -105,17 +105,25 @@ export default class LuoguProvider implements IBasicProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async submitProblem(id: string, lang: string, code: string, info) {
|
async submitProblem(id: string, lang: string, code: string, info) {
|
||||||
|
let enableO2 = 0;
|
||||||
const comment = setting.langs[lang]?.comment;
|
const comment = setting.langs[lang]?.comment;
|
||||||
if (comment) {
|
if (comment) {
|
||||||
const msg = `Hydro submission #${info.rid}@${new Date().toLocaleString()}`;
|
const msg = `Hydro submission #${info.rid}@${new Date().toLocaleString()}`;
|
||||||
if (typeof comment === 'string') code = `${comment} ${msg}\n${code}`;
|
if (typeof comment === 'string') code = `${comment} ${msg}\n${code}`;
|
||||||
else if (comment instanceof Array) code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
|
else if (comment instanceof Array) code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
|
||||||
}
|
}
|
||||||
|
if (lang.endsWith('o2')) {
|
||||||
|
enableO2 = 1;
|
||||||
|
lang = lang.slice(0, -2);
|
||||||
|
}
|
||||||
lang = lang.includes('luogu.') ? lang.split('luogu.')[1] : '0';
|
lang = lang.includes('luogu.') ? lang.split('luogu.')[1] : '0';
|
||||||
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
||||||
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
||||||
// TODO O2
|
.send({
|
||||||
.send({ code, lang: +lang, enableO2: 0 });
|
code,
|
||||||
|
lang: +lang,
|
||||||
|
enableO2,
|
||||||
|
});
|
||||||
logger.info('RecordID:', result.body.rid);
|
logger.info('RecordID:', result.body.rid);
|
||||||
return result.body.rid;
|
return result.body.rid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user