aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-14 15:33:49 +0100
committerChocobozzz <me@florianbigard.com>2018-02-14 16:03:09 +0100
commite3a682a877a10833cb54ac3595e55110bda95647 (patch)
tree4c9e2e31be234720a72988f2e9ad8f4a002ec4c8 /server/lib
parenta0922eb9b3750ab6de31116531b625643930b38c (diff)
downloadPeerTube-e3a682a877a10833cb54ac3595e55110bda95647.tar.gz
PeerTube-e3a682a877a10833cb54ac3595e55110bda95647.tar.zst
PeerTube-e3a682a877a10833cb54ac3595e55110bda95647.zip
Handle thumbnail update
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/process/process-update.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index c0038be64..c7ad412bc 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -11,7 +11,10 @@ import { ActorModel } from '../../../models/activitypub/actor'
11import { TagModel } from '../../../models/video/tag' 11import { TagModel } from '../../../models/video/tag'
12import { VideoFileModel } from '../../../models/video/video-file' 12import { VideoFileModel } from '../../../models/video/video-file'
13import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' 13import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor'
14import { getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes } from '../videos' 14import {
15 generateThumbnailFromUrl, getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes,
16 videoFileActivityUrlToDBAttributes
17} from '../videos'
15 18
16async function processUpdateActivity (activity: ActivityUpdate) { 19async function processUpdateActivity (activity: ActivityUpdate) {
17 const actor = await getOrCreateActorAndServerAndModel(activity.actor) 20 const actor = await getOrCreateActorAndServerAndModel(activity.actor)
@@ -82,6 +85,10 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) {
82 85
83 await videoInstance.save(sequelizeOptions) 86 await videoInstance.save(sequelizeOptions)
84 87
88 // Don't block on request
89 generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon)
90 .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, err))
91
85 // Remove old video files 92 // Remove old video files
86 const videoFileDestroyTasks: Bluebird<void>[] = [] 93 const videoFileDestroyTasks: Bluebird<void>[] = []
87 for (const videoFile of videoInstance.VideoFiles) { 94 for (const videoFile of videoInstance.VideoFiles) {