+ if (videoImportBody.targetUrl.includes('bad')) return { accepted: false, errorMessage: 'bad target url' }
+
+ return { accepted: true }
+ }
+ })
+
+ registerHook({
+ target: 'filter:api.video.pre-import-torrent.accept.result',
+ handler: ({ accepted }, { videoImportBody }) => {
+ if (!accepted) return { accepted: false }
+ if (videoImportBody.name.includes('bad torrent')) return { accepted: false, errorMessage: 'bad torrent' }
+
+ return { accepted: true }
+ }
+ })
+
+ registerHook({
+ target: 'filter:api.video.post-import-url.accept.result',
+ handler: ({ accepted }, { video }) => {
+ if (!accepted) return { accepted: false }
+ if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }
+
+ return { accepted: true }
+ }
+ })
+
+ registerHook({
+ target: 'filter:api.video.post-import-torrent.accept.result',
+ handler: ({ accepted }, { video }) => {
+ if (!accepted) return { accepted: false }
+ if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }