resetSequelizeInstance,
retryTransactionWrapper
} from '../../../helpers'
-import { getActivityPubUrl } from '../../../helpers/activitypub'
+import { getActivityPubUrl, shareVideoByServer } from '../../../helpers/activitypub'
import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers'
import { database as db } from '../../../initializers/database'
-import { sendAddVideo, sendUpdateVideoChannel } from '../../../lib/activitypub/send-request'
+import { sendAddVideo, sendUpdateVideo } from '../../../lib/activitypub/send-request'
import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler'
import {
asyncMiddleware,
randomString = 'fake-random-string'
}
- cb(null, randomString + '.' + extension)
+ cb(null, randomString + extension)
}
})
// Let transcoding job send the video to friends because the video file extension might change
if (CONFIG.TRANSCODING.ENABLED === true) return undefined
- // Don't send video to remote pods, it is private
+ // Don't send video to remote servers, it is private
if (video.privacy === VideoPrivacy.PRIVATE) return undefined
await sendAddVideo(video, t)
+ await shareVideoByServer(video, t)
})
logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID)
}
async function updateVideo (req: express.Request, res: express.Response) {
- const videoInstance = res.locals.video
+ const videoInstance: VideoInstance = res.locals.video
const videoFieldsSave = videoInstance.toJSON()
const videoInfoToUpdate: VideoUpdate = req.body
const wasPrivateVideo = videoInstance.privacy === VideoPrivacy.PRIVATE
// Now we'll update the video's meta data to our friends
if (wasPrivateVideo === false) {
- await sendUpdateVideoChannel(videoInstance, t)
+ await sendUpdateVideo(videoInstance, t)
}
- // Video is not private anymore, send a create action to remote pods
+ // Video is not private anymore, send a create action to remote servers
if (wasPrivateVideo === true && videoInstance.privacy !== VideoPrivacy.PRIVATE) {
await sendAddVideo(videoInstance, t)
+ await shareVideoByServer(videoInstance, t)
}
})
}
async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
- const resultList = await db.Video.searchAndPopulateAccountAndPodAndTags(
+ const resultList = await db.Video.searchAndPopulateAccountAndServerAndTags(
req.params.value,
req.query.field,
req.query.start,