aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/videos/shared
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/videos/shared')
-rw-r--r--server/lib/activitypub/videos/shared/abstract-builder.ts2
-rw-r--r--server/lib/activitypub/videos/shared/creator.ts10
-rw-r--r--server/lib/activitypub/videos/shared/video-sync-attributes.ts6
3 files changed, 10 insertions, 8 deletions
diff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/lib/activitypub/videos/shared/abstract-builder.ts
index f8e4d6aa3..4bd38b40c 100644
--- a/server/lib/activitypub/videos/shared/abstract-builder.ts
+++ b/server/lib/activitypub/videos/shared/abstract-builder.ts
@@ -43,7 +43,7 @@ export abstract class APVideoAbstractBuilder {
43 video, 43 video,
44 type: ThumbnailType.MINIATURE 44 type: ThumbnailType.MINIATURE
45 }).catch(err => { 45 }).catch(err => {
46 logger.warn('Cannot generate thumbnail of %s.', this.videoObject.id, { err, ...this.lTags(video.uuid) }) 46 logger.warn('Cannot generate thumbnail of %s.', this.videoObject.id, { err, ...this.lTags() })
47 47
48 return undefined 48 return undefined
49 }) 49 })
diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/lib/activitypub/videos/shared/creator.ts
index ba3f6f77f..767bf0695 100644
--- a/server/lib/activitypub/videos/shared/creator.ts
+++ b/server/lib/activitypub/videos/shared/creator.ts
@@ -1,5 +1,5 @@
1 1
2import { logger, loggerTagsFactory } from '@server/helpers/logger' 2import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
3import { sequelizeTypescript } from '@server/initializers/database' 3import { sequelizeTypescript } from '@server/initializers/database'
4import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' 4import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'
5import { VideoModel } from '@server/models/video/video' 5import { VideoModel } from '@server/models/video/video'
@@ -9,14 +9,16 @@ import { APVideoAbstractBuilder } from './abstract-builder'
9import { getVideoAttributesFromObject } from './object-to-model-attributes' 9import { getVideoAttributesFromObject } from './object-to-model-attributes'
10 10
11export class APVideoCreator extends APVideoAbstractBuilder { 11export class APVideoCreator extends APVideoAbstractBuilder {
12 protected lTags = loggerTagsFactory('ap', 'video', 'create') 12 protected lTags: LoggerTagsFn
13 13
14 constructor (protected readonly videoObject: VideoObject) { 14 constructor (protected readonly videoObject: VideoObject) {
15 super() 15 super()
16
17 this.lTags = loggerTagsFactory('ap', 'video', 'create', this.videoObject.uuid, this.videoObject.id)
16 } 18 }
17 19
18 async create (waitThumbnail = false) { 20 async create (waitThumbnail = false) {
19 logger.debug('Adding remote video %s.', this.videoObject.id, this.lTags(this.videoObject.uuid)) 21 logger.debug('Adding remote video %s.', this.videoObject.id, this.lTags())
20 22
21 const channelActor = await this.getOrCreateVideoChannelFromVideoObject() 23 const channelActor = await this.getOrCreateVideoChannelFromVideoObject()
22 const channel = channelActor.VideoChannel 24 const channel = channelActor.VideoChannel
@@ -57,7 +59,7 @@ export class APVideoCreator extends APVideoAbstractBuilder {
57 transaction: t 59 transaction: t
58 }) 60 })
59 61
60 logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags(videoCreated.uuid)) 62 logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags())
61 63
62 return { autoBlacklisted, videoCreated } 64 return { autoBlacklisted, videoCreated }
63 } catch (err) { 65 } catch (err) {
diff --git a/server/lib/activitypub/videos/shared/video-sync-attributes.ts b/server/lib/activitypub/videos/shared/video-sync-attributes.ts
index 102d40621..c4e101005 100644
--- a/server/lib/activitypub/videos/shared/video-sync-attributes.ts
+++ b/server/lib/activitypub/videos/shared/video-sync-attributes.ts
@@ -62,7 +62,7 @@ function syncRates (type: 'like' | 'dislike', video: MVideo, fetchedVideo: Video
62 const cleaner = crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, type, crawlStartDate) 62 const cleaner = crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, type, crawlStartDate)
63 63
64 return crawlCollectionPage<string>(uri, handler, cleaner) 64 return crawlCollectionPage<string>(uri, handler, cleaner)
65 .catch(err => logger.error('Cannot add rate of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid) })) 65 .catch(err => logger.error('Cannot add rate of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid, video.url) }))
66} 66}
67 67
68function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) { 68function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) {
@@ -76,7 +76,7 @@ function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean)
76 const cleaner = crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate) 76 const cleaner = crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate)
77 77
78 return crawlCollectionPage<string>(uri, handler, cleaner) 78 return crawlCollectionPage<string>(uri, handler, cleaner)
79 .catch(err => logger.error('Cannot add shares of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid) })) 79 .catch(err => logger.error('Cannot add shares of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid, video.url) }))
80} 80}
81 81
82function syncComments (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) { 82function syncComments (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) {
@@ -90,5 +90,5 @@ function syncComments (video: MVideo, fetchedVideo: VideoObject, isSync: boolean
90 const cleaner = crawlStartDate => VideoCommentModel.cleanOldCommentsOf(video.id, crawlStartDate) 90 const cleaner = crawlStartDate => VideoCommentModel.cleanOldCommentsOf(video.id, crawlStartDate)
91 91
92 return crawlCollectionPage<string>(uri, handler, cleaner) 92 return crawlCollectionPage<string>(uri, handler, cleaner)
93 .catch(err => logger.error('Cannot add comments of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid) })) 93 .catch(err => logger.error('Cannot add comments of video %s.', video.uuid, { err, rootUrl: uri, ...lTags(video.uuid, video.url) }))
94} 94}