aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-22 09:50:20 +0200
committerChocobozzz <me@florianbigard.com>2022-04-22 09:50:20 +0200
commit961cbe4269e5f34639e29310fb3d90a6cb1bd6bc (patch)
tree06404c72c25a95238e7ef8a6bdfcb90d40c8649c /server/middlewares/validators
parent4ec52d04dcc5d664612331f8e08d7d90da990415 (diff)
downloadPeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.gz
PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.zst
PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.zip
Fix getting live by anonymous user
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/videos/video-live.ts6
1 files changed, 1 insertions, 5 deletions
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts
index b756c0bf1..8f821c5f9 100644
--- a/server/middlewares/validators/videos/video-live.ts
+++ b/server/middlewares/validators/videos/video-live.ts
@@ -33,15 +33,11 @@ const videoLiveGetValidator = [
33 isValidVideoIdParam('videoId'), 33 isValidVideoIdParam('videoId'),
34 34
35 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 35 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
36 logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.params, user: res.locals.oauth.token.User.username }) 36 logger.debug('Checking videoLiveGetValidator parameters', { parameters: req.params })
37 37
38 if (areValidationErrors(req, res)) return 38 if (areValidationErrors(req, res)) return
39 if (!await doesVideoExist(req.params.videoId, res, 'all')) return 39 if (!await doesVideoExist(req.params.videoId, res, 'all')) return
40 40
41 // Check if the user who did the request is able to get the live info
42 const user = res.locals.oauth.token.User
43 if (!checkUserCanManageVideo(user, res.locals.videoAll, UserRight.GET_ANY_LIVE, res, false)) return
44
45 const videoLive = await VideoLiveModel.loadByVideoId(res.locals.videoAll.id) 41 const videoLive = await VideoLiveModel.loadByVideoId(res.locals.videoAll.id)
46 if (!videoLive) { 42 if (!videoLive) {
47 return res.fail({ 43 return res.fail({