]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/oembed.ts
Add filter hooks tests
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / oembed.ts
index 31f06dc65e9f747ecfbd19d70726b5fb879ba88a..0bb908d0b6719363a5f0c4e57279f8f940181b2c 100644 (file)
@@ -1,12 +1,14 @@
 import * as express from 'express'
 import { query } from 'express-validator/check'
 import { join } from 'path'
-import { isIdOrUUIDValid, isTestInstance, logger } from '../../helpers'
-import { CONFIG } from '../../initializers'
+import { isTestInstance } from '../../helpers/core-utils'
+import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
+import { doesVideoExist } from '../../helpers/custom-validators/videos'
+import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './utils'
-import { isVideoExist } from '../../helpers/custom-validators/videos'
+import { WEBSERVER } from '../../initializers/constants'
 
-const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/'
+const urlShouldStartWith = WEBSERVER.SCHEME + '://' + join(WEBSERVER.HOST, 'videos', 'watch') + '/'
 const videoWatchRegex = new RegExp('([^/]+)$')
 const isURLOptions = {
   require_host: true,
@@ -50,7 +52,7 @@ const oembedValidator = [
                 .end()
     }
 
-    if (!await isVideoExist(videoId, res)) return
+    if (!await doesVideoExist(videoId, res)) return
 
     return next()
   }