mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: feat: 直链下载additional_file
This commit is contained in:
1 parent
ea19d7997e
commit
91e7804fbb
2 files changed
+12
-1
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.15.9",
|
"version": "2.15.10",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -497,6 +497,16 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
||||||
|
@param('filename')
|
||||||
|
async get(domainId: string, filename: string) {
|
||||||
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
|
`problem/${this.pdoc.domainId}/${this.pdoc.docId}/additional_file/${filename}`,
|
||||||
|
filename, false, 'user',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class ProblemSolutionHandler extends ProblemDetailHandler {
|
export class ProblemSolutionHandler extends ProblemDetailHandler {
|
||||||
@param('page', Types.PositiveInt, true)
|
@param('page', Types.PositiveInt, true)
|
||||||
async get(domainId: string, page = 1) {
|
async get(domainId: string, page = 1) {
|
||||||
@@ -689,6 +699,7 @@ export async function apply() {
|
|||||||
Route('problem_statistics', '/p/:pid/statistics', ProblemStatisticsHandler);
|
Route('problem_statistics', '/p/:pid/statistics', ProblemStatisticsHandler);
|
||||||
Route('problem_edit', '/p/:pid/edit', ProblemEditHandler);
|
Route('problem_edit', '/p/:pid/edit', ProblemEditHandler);
|
||||||
Route('problem_files', '/p/:pid/files', ProblemFilesHandler);
|
Route('problem_files', '/p/:pid/files', ProblemFilesHandler);
|
||||||
|
Route('problem_file_download', '/p/:pid/file/:filename', ProblemFileDownloadHandler);
|
||||||
Route('problem_solution', '/p/:pid/solution', ProblemSolutionHandler);
|
Route('problem_solution', '/p/:pid/solution', ProblemSolutionHandler);
|
||||||
Route('problem_solution_raw', '/p/:pid/solution/:psid/raw', ProblemSolutionRawHandler);
|
Route('problem_solution_raw', '/p/:pid/solution/:psid/raw', ProblemSolutionRawHandler);
|
||||||
Route('problem_solution_reply_raw', '/p/:pid/solution/:psid/:psrid/raw', ProblemSolutionRawHandler);
|
Route('problem_solution_reply_raw', '/p/:pid/solution/:psid/:psrid/raw', ProblemSolutionRawHandler);
|
||||||
|
|||||||
Reference in new issue
Block a user