diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-28 10:32:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-28 10:32:40 +0200 |
commit | fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58 (patch) | |
tree | bd626648077f84fb4628af3a37acf260597fa0ef /server/middlewares/validators/search.ts | |
parent | f68d1cb6ac4aa4fb563b9eeb831fccffee260b2f (diff) | |
download | PeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.tar.gz PeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.tar.zst PeerTube-fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58.zip |
Filter host for channels and playlists search
Diffstat (limited to 'server/middlewares/validators/search.ts')
-rw-r--r-- | server/middlewares/validators/search.ts | 18 |
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 | ||
44 | const videoChannelsListSearchValidator = [ | 44 | const 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 | ||
57 | const videoPlaylistsListSearchValidator = [ | 64 | const 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 }) |