core&ui: language selection bug fix

This commit is contained in:
undefined committed 2022-09-10 16:42:50 +08:00
1 parent f1b1c89bf1
commit ff0d172dd3
7 files changed
+36 -23

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.17.4",
"version": "3.17.5",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+6
View File
@@ -349,6 +349,8 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
const p = this.pdoc.config.subType;
const dl = [p, ...Object.keys(setting.langs).filter((i) => i.startsWith(`${p}.`))];
baseLangs = dl;
} else if (['objective', 'submit_answer'].includes(this.pdoc.config.type)) {
baseLangs = ['_'];
} else {
baseLangs = Object.keys(setting.langs).filter((i) => !setting.langs[i].remote);
}
@@ -478,7 +480,11 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
async get() {
this.response.template = 'problem_submit.html';
const langRange = (typeof this.pdoc.config === 'object' && this.pdoc.config.langs)
? Object.fromEntries(this.pdoc.config.langs.map((i) => [i, setting.langs[i]?.display || i]))
: setting.SETTINGS_BY_KEY.codeLang.range;
this.response.body = {
langRange,
pdoc: this.pdoc,
udoc: this.udoc,
title: this.pdoc.title,