diff options
author | lutangar <johan.dufour@gmail.com> | 2021-12-17 16:41:01 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-12-23 09:35:35 +0100 |
commit | 5e3d29ab218f2e7fcfb59f64777d901625dc5a49 (patch) | |
tree | 40c98f82ffd0ab12f5e986049f6ea6938a3d347d /server/controllers/api/videos/captions.ts | |
parent | 293074ae7920040ede7e01d0aec4dabbeeb864ff (diff) | |
download | PeerTube-5e3d29ab218f2e7fcfb59f64777d901625dc5a49.tar.gz PeerTube-5e3d29ab218f2e7fcfb59f64777d901625dc5a49.tar.zst PeerTube-5e3d29ab218f2e7fcfb59f64777d901625dc5a49.zip |
Add video caption created and deleted hooks
Diffstat (limited to 'server/controllers/api/videos/captions.ts')
-rw-r--r-- | server/controllers/api/videos/captions.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 2d2213327..c0e60848b 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts | |||
@@ -12,6 +12,7 @@ import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' | |||
12 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 12 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
13 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' | 13 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' |
14 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 14 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
15 | import { Hooks } from '@server/lib/plugins/hooks' | ||
15 | 16 | ||
16 | const reqVideoCaptionAdd = createReqFiles( | 17 | const reqVideoCaptionAdd = createReqFiles( |
17 | [ 'captionfile' ], | 18 | [ 'captionfile' ], |
@@ -75,6 +76,8 @@ async function addVideoCaption (req: express.Request, res: express.Response) { | |||
75 | await federateVideoIfNeeded(video, false, t) | 76 | await federateVideoIfNeeded(video, false, t) |
76 | }) | 77 | }) |
77 | 78 | ||
79 | Hooks.runAction('action:api.video-caption.created', { caption: videoCaption, req, res }) | ||
80 | |||
78 | return res.status(HttpStatusCode.NO_CONTENT_204).end() | 81 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
79 | } | 82 | } |
80 | 83 | ||
@@ -91,5 +94,7 @@ async function deleteVideoCaption (req: express.Request, res: express.Response) | |||
91 | 94 | ||
92 | logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid) | 95 | logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid) |
93 | 96 | ||
97 | Hooks.runAction('action:api.video-caption.deleted', { caption: videoCaption, req, res }) | ||
98 | |||
94 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() | 99 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
95 | } | 100 | } |