ui: judge_config: add fast input case (#413)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
pandaandundefined authored and GitHub committed 2022-08-21 15:12:04 +08:00
1 parent b3e975cf38
commit b7cdadc255
6 files changed
+48 -8

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/vjudge",
"version": "1.5.0-next.6",
"version": "1.5.0-next.7",
"description": "Submit problems to remote oj",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
+1 -1
View File
@@ -32,7 +32,7 @@ export interface IBasicProvider {
}>;
entryProblemLists?: string[];
listProblem(page: number, resync: boolean, listId: string): Promise<string[]>;
submitProblem(id: string, lang: string, code: string, info: any, next: any, end: any): Promise<string>;
submitProblem(id: string, lang: string, code: string, info: any, next: any, end: any): Promise<string | void>;
waitForSubmission(id: string, next: any, end: any): Promise<void>;
}
+9 -4
View File
@@ -89,8 +89,6 @@ export default class LuoguProvider implements IBasicProvider {
}
async getProblem(id: string) {
logger.info(id);
// TODO
return {
title: id,
data: {},
@@ -104,9 +102,16 @@ export default class LuoguProvider implements IBasicProvider {
return [];
}
async submitProblem(id: string, lang: string, code: string, info) {
async submitProblem(id: string, lang: string, code: string, info, next, end) {
let enableO2 = 0;
const comment = setting.langs[lang]?.comment;
if (code.length < 10) {
end({ status: STATUS.STATUS_COMPILE_ERROR, message: 'Code too short' });
return null;
}
if (!lang.startsWith('luogu.')) {
end({ status: STATUS.STATUS_COMPILE_ERROR, message: `Language not supported: ${lang}` });
}
if (comment) {
const msg = `Hydro submission #${info.rid}@${new Date().toLocaleString()}`;
if (typeof comment === 'string') code = `${comment} ${msg}\n${code}`;
@@ -116,7 +121,7 @@ export default class LuoguProvider implements IBasicProvider {
enableO2 = 1;
lang = lang.slice(0, -2);
}
lang = lang.includes('luogu.') ? lang.split('luogu.')[1] : '0';
lang = lang.split('luogu.')[1];
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
.send({