diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-16 11:08:25 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | efc32059d980c51793e8e9ac0fb6a885a8026f94 (patch) | |
tree | c272e63fd57a9625b53dc26ceb1b46aee35d21d3 /server/controllers/api/videos/index.ts | |
parent | d846501818c2d29e66e6fd141789cb04fd55a437 (diff) | |
download | PeerTube-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/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 11 |
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' |
15 | import { getActivityPubUrl } from '../../../helpers/activitypub' | 15 | import { getActivityPubUrl, shareVideoByServer } from '../../../helpers/activitypub' |
16 | import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers' | 16 | import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers' |
17 | import { database as db } from '../../../initializers/database' | 17 | import { database as db } from '../../../initializers/database' |
18 | import { sendAddVideo, sendUpdateVideoChannel } from '../../../lib/activitypub/send-request' | 18 | import { sendAddVideo, sendUpdateVideo } from '../../../lib/activitypub/send-request' |
19 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler' | 19 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler' |
20 | import { | 20 | import { |
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 | ||
256 | async function updateVideo (req: express.Request, res: express.Response) { | 257 | async 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 |