mirror of https://github.com/Chocobozzz/PeerTube
feat(plugins/filter): add req to api.video.get.result
parent
e3161f4105
commit
ab22399da0
|
@ -150,11 +150,11 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) {
|
||||||
res.json(VIDEO_PRIVACIES)
|
res.json(VIDEO_PRIVACIES)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVideo (_req: express.Request, res: express.Response) {
|
async function getVideo (req: express.Request, res: express.Response) {
|
||||||
const videoId = res.locals.videoAPI.id
|
const videoId = res.locals.videoAPI.id
|
||||||
const userId = res.locals.oauth?.token.User.id
|
const userId = res.locals.oauth?.token.User.id
|
||||||
|
|
||||||
const video = await Hooks.wrapObject(res.locals.videoAPI, 'filter:api.video.get.result', { id: videoId, userId })
|
const video = await Hooks.wrapObject(res.locals.videoAPI, 'filter:api.video.get.result', { req, id: videoId, userId })
|
||||||
// Filter may return null/undefined value to forbid video access
|
// Filter may return null/undefined value to forbid video access
|
||||||
if (!video) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
|
if (!video) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue