mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: 修复部分情况下无法正常下载题目的问题
This commit is contained in:
1 parent
3ade228d47
commit
85def7213b
5 files changed
+11
-8
No files matched your search
@@ -80,7 +80,9 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
||||
|
||||
render() {
|
||||
const LANGS = {};
|
||||
const prefix = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
for (const key in window.LANGS) {
|
||||
if (prefix.has(key)) continue;
|
||||
if (UiContext.pdoc.config.langs && !UiContext.pdoc.config.langs.includes(key)) continue;
|
||||
LANGS[key] = window.LANGS[key];
|
||||
}
|
||||
|
||||
@@ -78,20 +78,20 @@ export async function downloadProblemSet(pids, name = 'Export') {
|
||||
tag: pdoc.tag,
|
||||
nSubmit: pdoc.nSubmit,
|
||||
nAccept: pdoc.nAccept,
|
||||
data: pdoc.data.map((i) => pick(i, ['name', 'lastModified', 'etag', 'size', '_id'])),
|
||||
additional_file: pdoc.additional_file.map((i) => pick(i, ['name', 'lastModified', 'etag', 'size', '_id'])),
|
||||
data: (pdoc.data || []).map((i) => pick(i, ['name', 'lastModified', 'etag', 'size', '_id'])),
|
||||
additional_file: (pdoc.additional_file || []).map((i) => pick(i, ['name', 'lastModified', 'etag', 'size', '_id'])),
|
||||
difficulty: pdoc.difficulty,
|
||||
}),
|
||||
});
|
||||
let { links } = await request.post(
|
||||
`/d/${UiContext.domainId}/p/${pid}/files`,
|
||||
{ operation: 'get_links', files: pdoc.data.map((i) => i.name), type: 'testdata' }
|
||||
{ operation: 'get_links', files: (pdoc.data || []).map((i) => i.name), type: 'testdata' }
|
||||
);
|
||||
for (const filename of Object.keys(links)) {
|
||||
targets.push({ filename: `${pid}/testdata/${filename}`, url: links[filename] });
|
||||
}
|
||||
({ links } = await request.post(`/d/${UiContext.domainId}/p/${pid}/files`, {
|
||||
operation: 'get_links', files: pdoc.additional_file.map((i) => i.name), type: 'additional_file',
|
||||
operation: 'get_links', files: (pdoc.additional_file || []).map((i) => i.name), type: 'additional_file',
|
||||
}));
|
||||
for (const filename of Object.keys(links)) {
|
||||
targets.push({ filename: `${pid}/additional_file/${filename}`, url: links[filename] });
|
||||
|
||||
@@ -4,7 +4,7 @@ const { join } = require('path');
|
||||
const crypto = require('crypto');
|
||||
const { tmpdir } = require('os');
|
||||
const bus = require('hydrooj/dist/service/bus');
|
||||
const markdown = require('./backendlib/markdown.js');
|
||||
const markdown = require('./backendlib/markdown');
|
||||
|
||||
const {
|
||||
system, domain, user, setting,
|
||||
@@ -18,7 +18,7 @@ class WikiHelpHandler extends Handler {
|
||||
}
|
||||
|
||||
async get() {
|
||||
const LANGS = system.get('hydrooj.langs');
|
||||
const LANGS = setting.langs;
|
||||
const languages = {};
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (const key in LANGS) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.11.15",
|
||||
"version": "4.11.16",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -32,8 +32,9 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', '
|
||||
$('[name="lang"]').val(this.value);
|
||||
});
|
||||
const main = {};
|
||||
const prefix = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
for (const key in window.LANGS) {
|
||||
if (UiContext.pdocConfig.langs && !UiContext.pdocConfig.langs.includes(key)) continue;
|
||||
if (UiContext.pdocConfig.langs && !prefix.has(key) && !UiContext.pdocConfig.langs.includes(key)) continue;
|
||||
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
||||
}
|
||||
setOptions($('#codelang-main-select'), main);
|
||||
|
||||
Reference in new issue
Block a user