aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/live.ts')
-rw-r--r--server/controllers/api/videos/live.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts
index be46fb1c6..f980c7730 100644
--- a/server/controllers/api/videos/live.ts
+++ b/server/controllers/api/videos/live.ts
@@ -4,6 +4,7 @@ import { createReqFiles } from '@server/helpers/express-utils'
4import { CONFIG } from '@server/initializers/config' 4import { CONFIG } from '@server/initializers/config'
5import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' 5import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
6import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' 6import { getVideoActivityPubUrl } from '@server/lib/activitypub/url'
7import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'
7import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' 8import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
8import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' 9import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live'
9import { VideoLiveModel } from '@server/models/video/video-live' 10import { VideoLiveModel } from '@server/models/video/video-live'
@@ -63,10 +64,13 @@ async function getLiveVideo (req: express.Request, res: express.Response) {
63async function updateLiveVideo (req: express.Request, res: express.Response) { 64async function updateLiveVideo (req: express.Request, res: express.Response) {
64 const body: LiveVideoUpdate = req.body 65 const body: LiveVideoUpdate = req.body
65 66
67 const video = res.locals.videoAll
66 const videoLive = res.locals.videoLive 68 const videoLive = res.locals.videoLive
67 videoLive.saveReplay = body.saveReplay || false 69 videoLive.saveReplay = body.saveReplay || false
68 70
69 await videoLive.save() 71 video.VideoLive = await videoLive.save()
72
73 await federateVideoIfNeeded(video, false)
70 74
71 return res.sendStatus(204) 75 return res.sendStatus(204)
72} 76}
@@ -113,10 +117,12 @@ async function addLiveVideo (req: express.Request, res: express.Response) {
113 videoCreated.VideoChannel = res.locals.videoChannel 117 videoCreated.VideoChannel = res.locals.videoChannel
114 118
115 videoLive.videoId = videoCreated.id 119 videoLive.videoId = videoCreated.id
116 await videoLive.save(sequelizeOptions) 120 videoCreated.VideoLive = await videoLive.save(sequelizeOptions)
117 121
118 await setVideoTags({ video, tags: videoInfo.tags, transaction: t }) 122 await setVideoTags({ video, tags: videoInfo.tags, transaction: t })
119 123
124 await federateVideoIfNeeded(videoCreated, true, t)
125
120 logger.info('Video live %s with uuid %s created.', videoInfo.name, videoCreated.uuid) 126 logger.info('Video live %s with uuid %s created.', videoInfo.name, videoCreated.uuid)
121 127
122 return { videoCreated } 128 return { videoCreated }