diff options
author | Chocobozzz <me@florianbigard.com> | 2022-12-06 13:50:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-12-06 13:50:18 +0100 |
commit | b6640fa0af863ae99fc33297bf59744bcd8fb2b8 (patch) | |
tree | c8cb137da5791abb1e0ebacf2de4b8226c9eeb09 | |
parent | bd09dfaf8dcb0ca4cd5dac9f13e3117486f3bcce (diff) | |
download | PeerTube-b6640fa0af863ae99fc33297bf59744bcd8fb2b8.tar.gz PeerTube-b6640fa0af863ae99fc33297bf59744bcd8fb2b8.tar.zst PeerTube-b6640fa0af863ae99fc33297bf59744bcd8fb2b8.zip |
Add req and res to allow download filter hooks
-rw-r--r-- | server/controllers/download.ts | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/server/controllers/download.ts b/server/controllers/download.ts index 65b9a1d1b..d675a2d6c 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts | |||
@@ -50,7 +50,12 @@ async function downloadTorrent (req: express.Request, res: express.Response) { | |||
50 | }) | 50 | }) |
51 | } | 51 | } |
52 | 52 | ||
53 | const allowParameters = { torrentPath: result.path, downloadName: result.downloadName } | 53 | const allowParameters = { |
54 | req, | ||
55 | res, | ||
56 | torrentPath: result.path, | ||
57 | downloadName: result.downloadName | ||
58 | } | ||
54 | 59 | ||
55 | const allowedResult = await Hooks.wrapFun( | 60 | const allowedResult = await Hooks.wrapFun( |
56 | isTorrentDownloadAllowed, | 61 | isTorrentDownloadAllowed, |
@@ -74,7 +79,12 @@ async function downloadVideoFile (req: express.Request, res: express.Response) { | |||
74 | }) | 79 | }) |
75 | } | 80 | } |
76 | 81 | ||
77 | const allowParameters = { video, videoFile } | 82 | const allowParameters = { |
83 | req, | ||
84 | res, | ||
85 | video, | ||
86 | videoFile | ||
87 | } | ||
78 | 88 | ||
79 | const allowedResult = await Hooks.wrapFun( | 89 | const allowedResult = await Hooks.wrapFun( |
80 | isVideoDownloadAllowed, | 90 | isVideoDownloadAllowed, |
@@ -110,7 +120,13 @@ async function downloadHLSVideoFile (req: express.Request, res: express.Response | |||
110 | }) | 120 | }) |
111 | } | 121 | } |
112 | 122 | ||
113 | const allowParameters = { video, streamingPlaylist, videoFile } | 123 | const allowParameters = { |
124 | req, | ||
125 | res, | ||
126 | video, | ||
127 | streamingPlaylist, | ||
128 | videoFile | ||
129 | } | ||
114 | 130 | ||
115 | const allowedResult = await Hooks.wrapFun( | 131 | const allowedResult = await Hooks.wrapFun( |
116 | isVideoDownloadAllowed, | 132 | isVideoDownloadAllowed, |