diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-23 11:54:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-24 18:18:41 +0100 |
commit | 4bc45da342597fb49593fc14c40f8dc5a97bb64e (patch) | |
tree | 9fa876e21995b27827fbc4467bd71b8d427312e2 /server/tests/fixtures/peertube-plugin-test | |
parent | c0ab041c2c749db05ce564d3078c2ad10d18f35f (diff) | |
download | PeerTube-4bc45da342597fb49593fc14c40f8dc5a97bb64e.tar.gz PeerTube-4bc45da342597fb49593fc14c40f8dc5a97bb64e.tar.zst PeerTube-4bc45da342597fb49593fc14c40f8dc5a97bb64e.zip |
Add hooks support for video download
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test/main.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index 305d92002..9913d0846 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js | |||
@@ -184,6 +184,32 @@ async function register ({ registerHook, registerSetting, settingsManager, stora | |||
184 | return result | 184 | return result |
185 | } | 185 | } |
186 | }) | 186 | }) |
187 | |||
188 | registerHook({ | ||
189 | target: 'filter:api.download.torrent.allowed.result', | ||
190 | handler: (result, params) => { | ||
191 | if (params && params.downloadName.includes('bad torrent')) { | ||
192 | return { allowed: false, errorMessage: 'Liu Bei' } | ||
193 | } | ||
194 | |||
195 | return result | ||
196 | } | ||
197 | }) | ||
198 | |||
199 | registerHook({ | ||
200 | target: 'filter:api.download.video.allowed.result', | ||
201 | handler: (result, params) => { | ||
202 | if (params && !params.streamingPlaylist && params.video.name.includes('bad file')) { | ||
203 | return { allowed: false, errorMessage: 'Cao Cao' } | ||
204 | } | ||
205 | |||
206 | if (params && params.streamingPlaylist && params.video.name.includes('bad playlist file')) { | ||
207 | return { allowed: false, errorMessage: 'Sun Jian' } | ||
208 | } | ||
209 | |||
210 | return result | ||
211 | } | ||
212 | }) | ||
187 | } | 213 | } |
188 | 214 | ||
189 | async function unregister () { | 215 | async function unregister () { |