From 5e3d29ab218f2e7fcfb59f64777d901625dc5a49 Mon Sep 17 00:00:00 2001 From: lutangar Date: Fri, 17 Dec 2021 16:41:01 +0100 Subject: Add video caption created and deleted hooks --- server/controllers/api/videos/captions.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server/controllers/api') 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' import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' import { VideoCaptionModel } from '../../../models/video/video-caption' +import { Hooks } from '@server/lib/plugins/hooks' const reqVideoCaptionAdd = createReqFiles( [ 'captionfile' ], @@ -75,6 +76,8 @@ async function addVideoCaption (req: express.Request, res: express.Response) { await federateVideoIfNeeded(video, false, t) }) + Hooks.runAction('action:api.video-caption.created', { caption: videoCaption, req, res }) + return res.status(HttpStatusCode.NO_CONTENT_204).end() } @@ -91,5 +94,7 @@ async function deleteVideoCaption (req: express.Request, res: express.Response) logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid) + Hooks.runAction('action:api.video-caption.deleted', { caption: videoCaption, req, res }) + return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() } -- cgit v1.2.3