aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 22a88620a..8c9b0aa50 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -12,10 +12,11 @@ import {
12 resetSequelizeInstance, 12 resetSequelizeInstance,
13 retryTransactionWrapper 13 retryTransactionWrapper
14} from '../../../helpers' 14} from '../../../helpers'
15import { getActivityPubUrl, shareVideoByServer } from '../../../helpers/activitypub' 15import { getVideoActivityPubUrl, shareVideoByServer } from '../../../helpers/activitypub'
16import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers' 16import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers'
17import { database as db } from '../../../initializers/database' 17import { database as db } from '../../../initializers/database'
18import { sendAddVideo, sendUpdateVideo } from '../../../lib/activitypub/send-request' 18import { sendAddVideo } from '../../../lib/activitypub/send/send-add'
19import { sendUpdateVideo } from '../../../lib/activitypub/send/send-update'
19import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler' 20import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler'
20import { 21import {
21 asyncMiddleware, 22 asyncMiddleware,
@@ -175,7 +176,7 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi
175 channelId: res.locals.videoChannel.id 176 channelId: res.locals.videoChannel.id
176 } 177 }
177 const video = db.Video.build(videoData) 178 const video = db.Video.build(videoData)
178 video.url = getActivityPubUrl('video', video.uuid) 179 video.url = getVideoActivityPubUrl(video)
179 180
180 const videoFilePath = join(CONFIG.STORAGE.VIDEOS_DIR, videoPhysicalFile.filename) 181 const videoFilePath = join(CONFIG.STORAGE.VIDEOS_DIR, videoPhysicalFile.filename)
181 const videoFileHeight = await getVideoFileHeight(videoFilePath) 182 const videoFileHeight = await getVideoFileHeight(videoFilePath)
@@ -274,7 +275,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
274 if (videoInfoToUpdate.privacy !== undefined) videoInstance.set('privacy', videoInfoToUpdate.privacy) 275 if (videoInfoToUpdate.privacy !== undefined) videoInstance.set('privacy', videoInfoToUpdate.privacy)
275 if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description) 276 if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description)
276 277
277 await videoInstance.save(sequelizeOptions) 278 const videoInstanceUpdated = await videoInstance.save(sequelizeOptions)
278 279
279 if (videoInfoToUpdate.tags) { 280 if (videoInfoToUpdate.tags) {
280 const tagInstances = await db.Tag.findOrCreateTags(videoInfoToUpdate.tags, t) 281 const tagInstances = await db.Tag.findOrCreateTags(videoInfoToUpdate.tags, t)
@@ -285,7 +286,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
285 286
286 // Now we'll update the video's meta data to our friends 287 // Now we'll update the video's meta data to our friends
287 if (wasPrivateVideo === false) { 288 if (wasPrivateVideo === false) {
288 await sendUpdateVideo(videoInstance, t) 289 await sendUpdateVideo(videoInstanceUpdated, t)
289 } 290 }
290 291
291 // Video is not private anymore, send a create action to remote servers 292 // Video is not private anymore, send a create action to remote servers