]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/oembed.ts
Fix express validator
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / oembed.ts
index cd9b27b164490e7a5d5e12724e2e4e810c0e4281..24ba5569dc9f1fd9f62a815bea870afe19ea0f3c 100644 (file)
@@ -1,14 +1,14 @@
 import * as express from 'express'
-import { query } from 'express-validator/check'
+import { query } from 'express-validator'
 import { join } from 'path'
 import { isTestInstance } from '../../helpers/core-utils'
 import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
-import { isVideoExist } from '../../helpers/custom-validators/videos'
 import { logger } from '../../helpers/logger'
-import { CONFIG } from '../../initializers'
 import { areValidationErrors } from './utils'
+import { WEBSERVER } from '../../initializers/constants'
+import { doesVideoExist } from '../../helpers/middlewares'
 
-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,
@@ -52,7 +52,7 @@ const oembedValidator = [
                 .end()
     }
 
-    if (!await isVideoExist(videoId, res)) return
+    if (!await doesVideoExist(videoId, res)) return
 
     return next()
   }