aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-03 11:17:57 +0200
committerChocobozzz <me@florianbigard.com>2022-08-03 11:24:42 +0200
commit0260dc8aca952f9412a8620e433b9e16e675696e (patch)
tree6f3e6dde7242a4f61aff99fd4c35b4e7f5076314 /server/controllers/api/videos
parent9ca0f688e9e8558233f1a538b96a43da44e35353 (diff)
downloadPeerTube-0260dc8aca952f9412a8620e433b9e16e675696e.tar.gz
PeerTube-0260dc8aca952f9412a8620e433b9e16e675696e.tar.zst
PeerTube-0260dc8aca952f9412a8620e433b9e16e675696e.zip
Add channel server hooks
Diffstat (limited to 'server/controllers/api/videos')
-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 } })