From 0260dc8aca952f9412a8620e433b9e16e675696e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Aug 2022 11:17:57 +0200 Subject: Add channel server hooks --- server/tests/fixtures/peertube-plugin-test/main.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (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 c395ac7aa..8d7584eba 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js @@ -7,6 +7,10 @@ async function register ({ registerHook, registerSetting, settingsManager, stora 'action:api.video.uploaded', 'action:api.video.viewed', + 'action:api.video-channel.created', + 'action:api.video-channel.updated', + 'action:api.video-channel.deleted', + 'action:api.live-video.created', 'action:api.video-thread.created', @@ -93,6 +97,29 @@ async function register ({ registerHook, registerSetting, settingsManager, stora } }) + // --------------------------------------------------------------------------- + + registerHook({ + target: 'filter:api.video-channels.list.params', + handler: obj => addToCount(obj, 1) + }) + + registerHook({ + target: 'filter:api.video-channels.list.result', + handler: obj => addToTotal(obj, 1) + }) + + registerHook({ + target: 'filter:api.video-channel.get.result', + handler: channel => { + channel.name += ' <3' + + return channel + } + }) + + // --------------------------------------------------------------------------- + for (const hook of [ 'filter:api.video.upload.accept.result', 'filter:api.live-video.create.accept.result' ]) { registerHook({ target: hook, -- cgit v1.2.3