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.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 35992e993..5fdb7d5bc 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -100,7 +100,7 @@ videosRouter.get('/:id/metadata/:videoFileId',
100videosRouter.get('/:id', 100videosRouter.get('/:id',
101 openapiOperationDoc({ operationId: 'getVideo' }), 101 openapiOperationDoc({ operationId: 'getVideo' }),
102 optionalAuthenticate, 102 optionalAuthenticate,
103 asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), 103 asyncMiddleware(videosCustomGetValidator('for-api')),
104 asyncMiddleware(checkVideoFollowConstraints), 104 asyncMiddleware(checkVideoFollowConstraints),
105 asyncMiddleware(getVideo) 105 asyncMiddleware(getVideo)
106) 106)
@@ -142,14 +142,7 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) {
142} 142}
143 143
144async function getVideo (_req: express.Request, res: express.Response) { 144async function getVideo (_req: express.Request, res: express.Response) {
145 // We need more attributes 145 const video = res.locals.videoAPI
146 const userId: number = res.locals.oauth ? res.locals.oauth.token.User.id : null
147
148 const video = await Hooks.wrapPromiseFun(
149 VideoModel.loadForGetAPI,
150 { id: _req.params.id, userId },
151 'filter:api.video.get.result'
152 )
153 146
154 if (video.isOutdated()) { 147 if (video.isOutdated()) {
155 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } }) 148 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } })