aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index d4e08293e..eca72c397 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -110,7 +110,7 @@ videosRouter.get('/:id',
110 optionalAuthenticate, 110 optionalAuthenticate,
111 asyncMiddleware(videosCustomGetValidator('for-api')), 111 asyncMiddleware(videosCustomGetValidator('for-api')),
112 asyncMiddleware(checkVideoFollowConstraints), 112 asyncMiddleware(checkVideoFollowConstraints),
113 getVideo 113 asyncMiddleware(getVideo)
114) 114)
115 115
116videosRouter.delete('/:id', 116videosRouter.delete('/:id',
@@ -144,8 +144,11 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) {
144 res.json(VIDEO_PRIVACIES) 144 res.json(VIDEO_PRIVACIES)
145} 145}
146 146
147function getVideo (_req: express.Request, res: express.Response) { 147async function getVideo (_req: express.Request, res: express.Response) {
148 const video = res.locals.videoAPI 148 const videoId = res.locals.videoAPI.id
149 const userId = res.locals.oauth?.token.User.id
150
151 const video = await Hooks.wrapObject(res.locals.videoAPI, 'filter:api.video.get.result', { id: videoId, userId })
149 152
150 if (video.isOutdated()) { 153 if (video.isOutdated()) {
151 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } }) 154 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } })