aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/oembed.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-24 19:41:09 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-26 09:11:38 +0200
commit72c7248b6fdcdb2175e726ff51b42e7555f2bd84 (patch)
tree1bfdee99dbe2392cc997edba8e314e2a8a401c72 /server/middlewares/validators/oembed.ts
parent8113a93a0d9f31aa9e23702bbc31b8a76275ae22 (diff)
downloadPeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.gz
PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.zst
PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.zip
Add video channels
Diffstat (limited to 'server/middlewares/validators/oembed.ts')
-rw-r--r--server/middlewares/validators/oembed.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/middlewares/validators/oembed.ts b/server/middlewares/validators/oembed.ts
index 4b8c03faf..f8e34d2d4 100644
--- a/server/middlewares/validators/oembed.ts
+++ b/server/middlewares/validators/oembed.ts
@@ -4,9 +4,12 @@ import { join } from 'path'
4 4
5import { checkErrors } from './utils' 5import { checkErrors } from './utils'
6import { CONFIG } from '../../initializers' 6import { CONFIG } from '../../initializers'
7import { logger } from '../../helpers' 7import {
8import { checkVideoExists, isVideoIdOrUUIDValid } from '../../helpers/custom-validators/videos' 8 logger,
9import { isTestInstance } from '../../helpers/core-utils' 9 isTestInstance,
10 checkVideoExists,
11 isIdOrUUIDValid
12} from '../../helpers'
10 13
11const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/' 14const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/'
12const videoWatchRegex = new RegExp('([^/]+)$') 15const videoWatchRegex = new RegExp('([^/]+)$')
@@ -45,7 +48,7 @@ const oembedValidator = [
45 } 48 }
46 49
47 const videoId = matches[1] 50 const videoId = matches[1]
48 if (isVideoIdOrUUIDValid(videoId) === false) { 51 if (isIdOrUUIDValid(videoId) === false) {
49 return res.status(400) 52 return res.status(400)
50 .json({ error: 'Invalid video id.' }) 53 .json({ error: 'Invalid video id.' })
51 .end() 54 .end()