diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-03 11:17:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-03 11:24:42 +0200 |
commit | 0260dc8aca952f9412a8620e433b9e16e675696e (patch) | |
tree | 6f3e6dde7242a4f61aff99fd4c35b4e7f5076314 /server/controllers/api/videos | |
parent | 9ca0f688e9e8558233f1a538b96a43da44e35353 (diff) | |
download | PeerTube-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.ts | 9 |
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 | ||
116 | videosRouter.delete('/:id', | 116 | videosRouter.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 | ||
147 | function getVideo (_req: express.Request, res: express.Response) { | 147 | async 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 } }) |