mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: remote judge api
This commit is contained in:
1 parent
939584ec5e
commit
680e3ccd32
11 files changed
+54
-13
No files matched your search
@@ -295,7 +295,8 @@ export class ContestProblemHandler extends Handler {
|
||||
// Navigate to current additional file download
|
||||
// e.g.  will navigate to 
|
||||
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,
|
||||
|
||||
@@ -168,7 +168,8 @@ class HomeworkDetailProblemHandler extends Handler {
|
||||
// Navigate to current additional file download
|
||||
// e.g.  will navigate to 
|
||||
this.response.body.pdoc.content = this.response.body.pdoc.content
|
||||
.replace(/\(file:\/\//g, `(./${pid}/file/`);
|
||||
.replace(/\(file:\/\//g, `(./${pid}/file/`)
|
||||
.reaplce(/="file:\/\//g, `="./${pid}/file/`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +220,9 @@ class HomeworkDetailProblemSubmitHandler extends HomeworkDetailProblemHandler {
|
||||
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, 5);
|
||||
const rid = await record.add(domainId, pid, this.user._id, lang, code, true, pretest ? input : {
|
||||
type: document.TYPE_HOMEWORK,
|
||||
|
||||
@@ -212,7 +212,8 @@ export class ProblemDetailHandler extends ProblemHandler {
|
||||
// e.g.  will navigate to 
|
||||
if (!this.request.json) {
|
||||
this.response.body.pdoc.content = this.response.body.pdoc.content
|
||||
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`);
|
||||
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`)
|
||||
.replace(/="file:\/\//g, `="./${this.pdoc.docId}/file/`);
|
||||
}
|
||||
if (this.psdoc) {
|
||||
this.response.body.rdoc = await record.get(this.domainId, this.psdoc.rid);
|
||||
@@ -269,6 +270,9 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
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, 5);
|
||||
const rid = await record.add(domainId, this.pdoc.docId, this.user._id, lang, code, true, pretest ? input : undefined);
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
|
||||
Reference in new issue
Block a user