mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: problem_download: support multi-locale problem
This commit is contained in:
1 parent
e1a1e35f94
commit
c5dd6af8c1
2 files changed
+16
-5
No files matched your search
@@ -100,10 +100,21 @@ export async function downloadProblemSet(pids, name = 'Export') {
|
|||||||
nAccept: pdoc.nAccept,
|
nAccept: pdoc.nAccept,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
targets.push({
|
try {
|
||||||
filename: `${pid}/problem.md`,
|
const c = JSON.parse(pdoc.content);
|
||||||
content: pdoc.content,
|
if (c instanceof Array || typeof c === 'string') throw new Error();
|
||||||
});
|
for (const key of Object.keys(c)) {
|
||||||
|
targets.push({
|
||||||
|
filename: `${pid}/problem_${key}.md`,
|
||||||
|
content: typeof c[key] === 'string' ? c[key] : JSON.stringify(c[key]),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
targets.push({
|
||||||
|
filename: `${pid}/problem.md`,
|
||||||
|
content: pdoc.content,
|
||||||
|
});
|
||||||
|
}
|
||||||
let { links } = await request.post(
|
let { links } = await request.post(
|
||||||
`/d/${UiContext.domainId}/p/${pid}/files`,
|
`/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' },
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.32.13",
|
"version": "4.32.14",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user