aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-16 11:08:25 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commitefc32059d980c51793e8e9ac0fb6a885a8026f94 (patch)
treec272e63fd57a9625b53dc26ceb1b46aee35d21d3 /server/controllers/api/videos
parentd846501818c2d29e66e6fd141789cb04fd55a437 (diff)
downloadPeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.tar.gz
PeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.tar.zst
PeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.zip
Send server announce when users upload a video
Diffstat (limited to 'server/controllers/api/videos')
-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 ebc07e179..a5414cc50 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -12,10 +12,10 @@ import {
12 resetSequelizeInstance, 12 resetSequelizeInstance,
13 retryTransactionWrapper 13 retryTransactionWrapper
14} from '../../../helpers' 14} from '../../../helpers'
15import { getActivityPubUrl } from '../../../helpers/activitypub' 15import { getActivityPubUrl, 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, sendUpdateVideoChannel } from '../../../lib/activitypub/send-request' 18import { sendAddVideo, sendUpdateVideo } from '../../../lib/activitypub/send-request'
19import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler' 19import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler'
20import { 20import {
21 asyncMiddleware, 21 asyncMiddleware,
@@ -56,7 +56,7 @@ const storage = multer.diskStorage({
56 randomString = 'fake-random-string' 56 randomString = 'fake-random-string'
57 } 57 }
58 58
59 cb(null, randomString + '.' + extension) 59 cb(null, randomString + extension)
60 } 60 }
61}) 61})
62 62
@@ -237,6 +237,7 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi
237 if (video.privacy === VideoPrivacy.PRIVATE) return undefined 237 if (video.privacy === VideoPrivacy.PRIVATE) return undefined
238 238
239 await sendAddVideo(video, t) 239 await sendAddVideo(video, t)
240 await shareVideoByServer(video, t)
240 }) 241 })
241 242
242 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID) 243 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID)
@@ -254,7 +255,7 @@ async function updateVideoRetryWrapper (req: express.Request, res: express.Respo
254} 255}
255 256
256async function updateVideo (req: express.Request, res: express.Response) { 257async function updateVideo (req: express.Request, res: express.Response) {
257 const videoInstance = res.locals.video 258 const videoInstance: VideoInstance = res.locals.video
258 const videoFieldsSave = videoInstance.toJSON() 259 const videoFieldsSave = videoInstance.toJSON()
259 const videoInfoToUpdate: VideoUpdate = req.body 260 const videoInfoToUpdate: VideoUpdate = req.body
260 const wasPrivateVideo = videoInstance.privacy === VideoPrivacy.PRIVATE 261 const wasPrivateVideo = videoInstance.privacy === VideoPrivacy.PRIVATE
@@ -284,7 +285,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
284 285
285 // Now we'll update the video's meta data to our friends 286 // Now we'll update the video's meta data to our friends
286 if (wasPrivateVideo === false) { 287 if (wasPrivateVideo === false) {
287 await sendUpdateVideoChannel(videoInstance, t) 288 await sendUpdateVideo(videoInstance, t)
288 } 289 }
289 290
290 // Video is not private anymore, send a create action to remote servers 291 // Video is not private anymore, send a create action to remote servers