mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: lang: add disabled option
This commit is contained in:
1 parent
2cd89d7258
commit
88461a78cd
3 files changed
+5
-2
No files matched your search
@@ -507,7 +507,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
if (typeof config === 'string' || config === null) throw new ProblemConfigError();
|
||||
if (config.type === 'objective') {
|
||||
lang = '_';
|
||||
} else if (config.langs && !config.langs.includes(lang)) {
|
||||
} else if ((config.langs && !config.langs.includes(lang)) || setting.langs[lang].disabled) {
|
||||
throw new ProblemNotAllowLanguageError();
|
||||
}
|
||||
if (pretest) {
|
||||
|
||||
@@ -33,7 +33,8 @@ export function getAvailableLangs(langsList?: string[]) {
|
||||
for (const key in window.LANGS) {
|
||||
if (prefixes.has(key)) continue;
|
||||
if (langsList && langsList.length && langsList.join('') && !langsList.includes(key)) continue;
|
||||
else if (window.LANGS[key].hidden && !langsList?.includes(key)) continue;
|
||||
if (window.LANGS[key].hidden && !langsList?.includes(key)) continue;
|
||||
if (window.LANGS[key].disabled) continue;
|
||||
Langs[key] = window.LANGS[key];
|
||||
}
|
||||
return Langs;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import yaml from 'js-yaml';
|
||||
|
||||
export interface LangConfig {
|
||||
disabled?: boolean;
|
||||
compile?: string;
|
||||
execute: string;
|
||||
code_file: string;
|
||||
@@ -41,6 +42,7 @@ export function parseLang(config: string): Record<string, LangConfig> {
|
||||
entry.execute ||= '/w/foo';
|
||||
entry.key = key;
|
||||
entry.hidden ||= false;
|
||||
entry.disabled ||= false;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
Reference in new issue
Block a user