core: remote judge api

This commit is contained in:
undefined committed 2021-06-21 13:39:39 +08:00
1 parent 939584ec5e
commit 680e3ccd32
11 files changed
+54 -13

No files matched your search

+5 -1
View File
@@ -295,7 +295,8 @@ export class ContestProblemHandler extends Handler {
// Navigate to current additional file download
// e.g. ![img](a.jpg) will navigate to ![img](./pid/file/a.jpg)
this.response.body.pdoc.content = this.response.body.pdoc.content
.replace(/\(file:\/\//g, `(./${args[2]}/file/`);
.replace(/\(file:\/\//g, `(./${args[2]}/file/`)
.replace(/="file:\/\//g, `="./${args[2]}/file/`);
}
}
@@ -344,6 +345,9 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
throw new BadRequestError('Language not allowed.');
}
if (this.domain.langs && !this.domain.langs.includes(lang)) {
throw new BadRequestError('Language not allowed');
}
await this.limitRate('add_record', 60, 10);
const rid = await record.add(domainId, pid, this.user._id, lang, code, true, pretest ? input : {
type: document.TYPE_CONTEST,