ui: problem_download: support multi-locale problem

This commit is contained in:
undefined committed 2022-03-02 18:03:05 +08:00
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,
}),
});
targets.push({
filename: `${pid}/problem.md`,
content: pdoc.content,
});
try {
const c = JSON.parse(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(
`/d/${UiContext.domainId}/p/${pid}/files`,
{ operation: 'get_links', files: (pdoc.data || []).map((i) => i.name), type: 'testdata' },
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.32.13",
"version": "4.32.14",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",