import { extname, join } from 'path'
import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared'
import {
- fetchRemoteVideoDescription,
generateRandomString,
getFormattedObjects,
getVideoFileHeight,
resetSequelizeInstance,
retryTransactionWrapper
} from '../../../helpers'
-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, sendUpdateVideo } from '../../../lib/activitypub/send-request'
+import { sendAddVideo } from '../../../lib/activitypub/send/send-add'
+import { sendUpdateVideo } from '../../../lib/activitypub/send/send-update'
import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler'
import {
asyncMiddleware,
import { blacklistRouter } from './blacklist'
import { videoChannelRouter } from './channel'
import { rateVideoRouter } from './rate'
+import { getVideoActivityPubUrl } from '../../../lib/activitypub/url'
+import { shareVideoByServer } from '../../../lib/activitypub/share'
+import { fetchRemoteVideoDescription } from '../../../lib/activitypub/videos'
const videosRouter = express.Router()
channelId: res.locals.videoChannel.id
}
const video = db.Video.build(videoData)
- video.url = getActivityPubUrl('video', video.uuid)
+ video.url = getVideoActivityPubUrl(video)
const videoFilePath = join(CONFIG.STORAGE.VIDEOS_DIR, videoPhysicalFile.filename)
const videoFileHeight = await getVideoFileHeight(videoFilePath)
if (videoInfoToUpdate.privacy !== undefined) videoInstance.set('privacy', videoInfoToUpdate.privacy)
if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description)
- await videoInstance.save(sequelizeOptions)
+ const videoInstanceUpdated = await videoInstance.save(sequelizeOptions)
if (videoInfoToUpdate.tags) {
const tagInstances = await db.Tag.findOrCreateTags(videoInfoToUpdate.tags, t)
// Now we'll update the video's meta data to our friends
if (wasPrivateVideo === false) {
- await sendUpdateVideo(videoInstance, t)
+ await sendUpdateVideo(videoInstanceUpdated, t)
}
// Video is not private anymore, send a create action to remote servers