mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: contest file download
This commit is contained in:
1 parent
5c5864a7c2
commit
ea8bd323c7
2 files changed
+16
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.1.20",
|
"version": "3.1.21",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -313,15 +313,28 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
this.extraTitleContent = this.pdoc.title;
|
this.extraTitleContent = this.pdoc.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@query('tid', Types.ObjectID, true)
|
||||||
async get(..._args: any[]) {
|
async get(...args: any[]) {
|
||||||
// Navigate to current additional file download
|
// Navigate to current additional file download
|
||||||
// e.g.  will navigate to 
|
// e.g.  will navigate to 
|
||||||
if (!this.request.json) {
|
if (!this.request.json) {
|
||||||
|
if (args[1]) {
|
||||||
|
console.log(this.response.body.pdoc.content);
|
||||||
|
this.response.body.pdoc.content = this.response.body.pdoc.content
|
||||||
|
.replace(/\(file:\/\/(.+?)\)/g, (str) => {
|
||||||
|
const info = str.match(/\(file:\/\/(.+?)\)/);
|
||||||
|
return `(./${this.pdoc.docId}/file/${info[1]}${info[1].includes('?') ? '&' : '?'}tid=${args[1]})`;
|
||||||
|
})
|
||||||
|
.replace(/="file:\/\//g, (str) => {
|
||||||
|
const info = str.match(/="file:\/\/(.+?)"/);
|
||||||
|
return `="./${this.pdoc.docId}/file/${info[1]}${info[1].includes('?') ? '&' : '?'}tid=${args[1]}"`;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.response.body.pdoc.content = this.response.body.pdoc.content
|
this.response.body.pdoc.content = this.response.body.pdoc.content
|
||||||
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`)
|
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`)
|
||||||
.replace(/="file:\/\//g, `="./${this.pdoc.docId}/file/`);
|
.replace(/="file:\/\//g, `="./${this.pdoc.docId}/file/`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.response.body.page_name = this.tdoc
|
this.response.body.page_name = this.tdoc
|
||||||
? this.tdoc.rule === 'homework'
|
? this.tdoc.rule === 'homework'
|
||||||
? 'homework_detail_problem'
|
? 'homework_detail_problem'
|
||||||
|
|||||||
Reference in new issue
Block a user