diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-14 15:33:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-14 16:03:09 +0100 |
commit | e3a682a877a10833cb54ac3595e55110bda95647 (patch) | |
tree | 4c9e2e31be234720a72988f2e9ad8f4a002ec4c8 /server/lib | |
parent | a0922eb9b3750ab6de31116531b625643930b38c (diff) | |
download | PeerTube-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.ts | 9 |
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' | |||
11 | import { TagModel } from '../../../models/video/tag' | 11 | import { TagModel } from '../../../models/video/tag' |
12 | import { VideoFileModel } from '../../../models/video/video-file' | 12 | import { VideoFileModel } from '../../../models/video/video-file' |
13 | import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' | 13 | import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' |
14 | import { getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes } from '../videos' | 14 | import { |
15 | generateThumbnailFromUrl, getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, | ||
16 | videoFileActivityUrlToDBAttributes | ||
17 | } from '../videos' | ||
15 | 18 | ||
16 | async function processUpdateActivity (activity: ActivityUpdate) { | 19 | async 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) { |