diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/live.ts | 10 |
3 files changed, 10 insertions, 4 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 1da44d096..df2a01d2c 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -223,7 +223,7 @@ function getAccountVideoRateFactory (rateType: VideoRateType) { | |||
223 | 223 | ||
224 | async function videoController (req: express.Request, res: express.Response) { | 224 | async function videoController (req: express.Request, res: express.Response) { |
225 | // We need more attributes | 225 | // We need more attributes |
226 | const video = await VideoModel.loadForGetAPI({ id: res.locals.onlyVideoWithRights.id }) as MVideoAPWithoutCaption | 226 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(res.locals.onlyVideoWithRights.id) |
227 | 227 | ||
228 | if (video.url.startsWith(WEBSERVER.URL) === false) return res.redirect(video.url) | 228 | if (video.url.startsWith(WEBSERVER.URL) === false) return res.redirect(video.url) |
229 | 229 | ||
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 6357062bc..50e769e77 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -189,7 +189,7 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
189 | videoData.state = CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED | 189 | videoData.state = CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED |
190 | videoData.duration = videoPhysicalFile['duration'] // duration was added by a previous middleware | 190 | videoData.duration = videoPhysicalFile['duration'] // duration was added by a previous middleware |
191 | 191 | ||
192 | const video = new VideoModel(videoData) as MVideoDetails | 192 | const video = new VideoModel(videoData) as MVideoFullLight |
193 | video.url = getVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object | 193 | video.url = getVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object |
194 | 194 | ||
195 | const videoFile = new VideoFileModel({ | 195 | const videoFile = new VideoFileModel({ |
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' | |||
4 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' | 5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' |
6 | import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' | 6 | import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' |
7 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | ||
7 | import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' | 8 | import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' |
8 | import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' | 9 | import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' |
9 | import { VideoLiveModel } from '@server/models/video/video-live' | 10 | import { VideoLiveModel } from '@server/models/video/video-live' |
@@ -63,10 +64,13 @@ async function getLiveVideo (req: express.Request, res: express.Response) { | |||
63 | async function updateLiveVideo (req: express.Request, res: express.Response) { | 64 | async 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 } |