aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test/main.js')
-rw-r--r--server/tests/fixtures/peertube-plugin-test/main.js42
1 files changed, 41 insertions, 1 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js
index 69796ab07..a45e98fb5 100644
--- a/server/tests/fixtures/peertube-plugin-test/main.js
+++ b/server/tests/fixtures/peertube-plugin-test/main.js
@@ -50,7 +50,47 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
50 target: 'filter:api.video.upload.accept.result', 50 target: 'filter:api.video.upload.accept.result',
51 handler: ({ accepted }, { videoBody }) => { 51 handler: ({ accepted }, { videoBody }) => {
52 if (!accepted) return { accepted: false } 52 if (!accepted) return { accepted: false }
53 if (videoBody.name.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word '} 53 if (videoBody.name.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word' }
54
55 return { accepted: true }
56 }
57 })
58
59 registerHook({
60 target: 'filter:api.video.pre-import-url.accept.result',
61 handler: ({ accepted }, { videoImportBody }) => {
62 if (!accepted) return { accepted: false }
63 if (videoImportBody.targetUrl.includes('bad')) return { accepted: false, errorMessage: 'bad target url' }
64
65 return { accepted: true }
66 }
67 })
68
69 registerHook({
70 target: 'filter:api.video.pre-import-torrent.accept.result',
71 handler: ({ accepted }, { videoImportBody }) => {
72 if (!accepted) return { accepted: false }
73 if (videoImportBody.name.includes('bad torrent')) return { accepted: false, errorMessage: 'bad torrent' }
74
75 return { accepted: true }
76 }
77 })
78
79 registerHook({
80 target: 'filter:api.video.post-import-url.accept.result',
81 handler: ({ accepted }, { video }) => {
82 if (!accepted) return { accepted: false }
83 if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }
84
85 return { accepted: true }
86 }
87 })
88
89 registerHook({
90 target: 'filter:api.video.post-import-torrent.accept.result',
91 handler: ({ accepted }, { video }) => {
92 if (!accepted) return { accepted: false }
93 if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }
54 94
55 return { accepted: true } 95 return { accepted: true }
56 } 96 }