vjudge: luogu: o2

This commit is contained in:
undefined committed 2022-08-03 18:41:48 +08:00
1 parent 0a91d45849
commit 7101a3096c
2 files changed
+11 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/vjudge",
"version": "1.5.0-next.5",
"version": "1.5.0-next.6",
"description": "Submit problems to remote oj",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
+10 -2
View File
@@ -105,17 +105,25 @@ export default class LuoguProvider implements IBasicProvider {
}
async submitProblem(id: string, lang: string, code: string, info) {
let enableO2 = 0;
const comment = setting.langs[lang]?.comment;
if (comment) {
const msg = `Hydro submission #${info.rid}@${new Date().toLocaleString()}`;
if (typeof comment === 'string') code = `${comment} ${msg}\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';
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
// TODO O2
.send({ code, lang: +lang, enableO2: 0 });
.send({
code,
lang: +lang,
enableO2,
});
logger.info('RecordID:', result.body.rid);
return result.body.rid;
}