From 868314e8bf6bcc325b0fea35887071ef0614a46d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Dec 2022 09:15:49 +0100 Subject: Add ability to get user from file token --- server/tests/fixtures/peertube-plugin-test/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'server/tests/fixtures') diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index 19dccf26e..19ba9f278 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js @@ -250,7 +250,10 @@ async function register ({ registerHook, registerSetting, settingsManager, stora registerHook({ target: 'filter:api.download.video.allowed.result', - handler: (result, params) => { + handler: async (result, params) => { + const loggedInUser = await peertubeHelpers.user.getAuthUser(params.res) + if (loggedInUser) return { allowed: true } + if (params && !params.streamingPlaylist && params.video.name.includes('bad file')) { return { allowed: false, errorMessage: 'Cao Cao' } } -- cgit v1.2.3