core&ui: use langConfig.hidden for remote problems

This commit is contained in:
undefined committed 2022-03-12 20:49:41 +08:00
1 parent 73b1a04bd0
commit d60f31c427
10 files changed
+28 -27

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.8.6",
"version": "3.8.7",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+2 -1
View File
@@ -4,6 +4,7 @@ import os from 'os';
import path from 'path';
import fs from 'fs-extra';
import yaml from 'js-yaml';
import i18n from '../lib/i18n';
import { Logger } from '../logger';
import * as bus from '../service/bus';
@@ -75,7 +76,7 @@ export async function locale(pending: string[], fail: string[]) {
const content = fs.readFileSync(path.resolve(p, file)).toString();
locales[file.split('.')[0]] = yaml.load(content);
}
global.Hydro.lib.i18n(locales);
i18n(locales);
logger.info('Locale init: %s', i);
} catch (e) {
fail.push(i);
+11 -7
View File
@@ -311,13 +311,17 @@ export class ProblemDetailHandler extends ProblemHandler {
if (!ddoc || !pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid);
this.pdoc.config = pdoc.config;
}
if (ddoc.langs && typeof this.pdoc.config !== 'string') {
const dl = ddoc.langs.split(',').map((i) => i.trim()).filter((i) => i);
this.pdoc.config.langs = intersection(this.pdoc.config.langs || dl, dl);
}
if (this.domain.langs && typeof this.pdoc.config !== 'string') {
const dl = this.domain.langs.split(',').map((i) => i.trim()).filter((i) => i);
this.pdoc.config.langs = intersection(this.pdoc.config.langs || dl, dl);
if (typeof this.pdoc.config !== 'string') {
const t = [];
if (this.pdoc.config.langs) t.push(this.pdoc.config.langs);
if (ddoc.langs) t.push(ddoc.langs.split(',').map((i) => i.trim()).filter((i) => i));
if (this.domain.langs) t.push(this.domain.langs.split(',').map((i) => i.trim()).filter((i) => i));
if (this.pdoc.config.type === 'remote_judge') {
const p = this.pdoc.config.subType;
const dl = [p, ...Object.keys(setting.langs).filter((i) => i.startsWith(`${p}.`))];
t.push(dl);
}
if (t.length) this.pdoc.config.langs = intersection(...t);
}
await bus.serial('problem/get', this.pdoc, this);
[this.psdoc, this.udoc] = await Promise.all([