mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix remote judge langs
This commit is contained in:
1 parent
f79dbefd6c
commit
2fe5b8faee
2 files changed
+9
-5
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.33.10",
|
"version": "2.33.11",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isSafeInteger, flatten } from 'lodash';
|
import { isSafeInteger, flatten, intersection } from 'lodash';
|
||||||
import { FilterQuery, ObjectID } from 'mongodb';
|
import { FilterQuery, ObjectID } from 'mongodb';
|
||||||
import AdmZip from 'adm-zip';
|
import AdmZip from 'adm-zip';
|
||||||
import { sortFiles } from '@hydrooj/utils/lib/utils';
|
import { sortFiles } from '@hydrooj/utils/lib/utils';
|
||||||
@@ -277,6 +277,13 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
|||||||
udoc: this.udoc,
|
udoc: this.udoc,
|
||||||
title: this.pdoc.title,
|
title: this.pdoc.title,
|
||||||
};
|
};
|
||||||
|
if (this.domain.langs) {
|
||||||
|
this.response.body.pdoc.config.langs = intersection(
|
||||||
|
this.response.body.pdoc.config.langs || this.domain.langs.split(','),
|
||||||
|
this.domain.langs.split(','),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.response.body.pdoc.config.domainId = this.domainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('lang', Types.Name)
|
@param('lang', Types.Name)
|
||||||
@@ -287,9 +294,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
|||||||
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
|
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
|
||||||
throw new BadRequestError('Language not allowed.');
|
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, system.get('limit.submission'));
|
await this.limitRate('add_record', 60, system.get('limit.submission'));
|
||||||
const rid = await record.add(domainId, this.pdoc.docId, this.user._id, lang, code, true, pretest ? input : undefined);
|
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);
|
const rdoc = await record.get(domainId, rid);
|
||||||
|
|||||||
Reference in new issue
Block a user