aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-28 10:32:40 +0200
committerChocobozzz <me@florianbigard.com>2021-07-28 10:32:40 +0200
commitfa47956ecf51a6d5d10aeb25d2e4db3da90c7d58 (patch)
treebd626648077f84fb4628af3a37acf260597fa0ef /server/middlewares/validators
parentf68d1cb6ac4aa4fb563b9eeb831fccffee260b2f (diff)
downloadPeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.tar.gz
PeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.tar.zst
PeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.zip
Filter host for channels and playlists search
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/search.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts
index 6bb335127..ea6a490b2 100644
--- a/server/middlewares/validators/search.ts
+++ b/server/middlewares/validators/search.ts
@@ -43,7 +43,14 @@ const videosSearchValidator = [
43 43
44const videoChannelsListSearchValidator = [ 44const videoChannelsListSearchValidator = [
45 query('search').not().isEmpty().withMessage('Should have a valid search'), 45 query('search').not().isEmpty().withMessage('Should have a valid search'),
46 query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), 46
47 query('host')
48 .optional()
49 .custom(isHostValid).withMessage('Should have a valid host'),
50
51 query('searchTarget')
52 .optional()
53 .custom(isSearchTargetValid).withMessage('Should have a valid search target'),
47 54
48 (req: express.Request, res: express.Response, next: express.NextFunction) => { 55 (req: express.Request, res: express.Response, next: express.NextFunction) => {
49 logger.debug('Checking video channels search query', { parameters: req.query }) 56 logger.debug('Checking video channels search query', { parameters: req.query })
@@ -56,7 +63,14 @@ const videoChannelsListSearchValidator = [
56 63
57const videoPlaylistsListSearchValidator = [ 64const videoPlaylistsListSearchValidator = [
58 query('search').not().isEmpty().withMessage('Should have a valid search'), 65 query('search').not().isEmpty().withMessage('Should have a valid search'),
59 query('searchTarget').optional().custom(isSearchTargetValid).withMessage('Should have a valid search target'), 66
67 query('host')
68 .optional()
69 .custom(isHostValid).withMessage('Should have a valid host'),
70
71 query('searchTarget')
72 .optional()
73 .custom(isSearchTargetValid).withMessage('Should have a valid search target'),
60 74
61 (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 (req: express.Request, res: express.Response, next: express.NextFunction) => {
62 logger.debug('Checking video playlists search query', { parameters: req.query }) 76 logger.debug('Checking video playlists search query', { parameters: req.query })