aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/process/process-accept.ts4
-rw-r--r--server/lib/activitypub/process/process-announce.ts13
-rw-r--r--server/lib/activitypub/process/process-create.ts19
-rw-r--r--server/lib/activitypub/process/process-delete.ts5
-rw-r--r--server/lib/activitypub/process/process-dislike.ts4
-rw-r--r--server/lib/activitypub/process/process-flag.ts4
-rw-r--r--server/lib/activitypub/process/process-follow.ts4
-rw-r--r--server/lib/activitypub/process/process-like.ts4
-rw-r--r--server/lib/activitypub/process/process-reject.ts4
-rw-r--r--server/lib/activitypub/process/process-undo.ts4
-rw-r--r--server/lib/activitypub/process/process-update.ts5
-rw-r--r--server/lib/activitypub/process/process-view.ts4
-rw-r--r--server/lib/activitypub/process/process.ts23
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-fetcher.ts2
-rw-r--r--server/lib/plugins/plugin-manager.ts4
-rw-r--r--server/typings/activitypub-processor.model.ts9
16 files changed, 78 insertions, 34 deletions
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts
index ebb275e34..72bb1975e 100644
--- a/server/lib/activitypub/process/process-accept.ts
+++ b/server/lib/activitypub/process/process-accept.ts
@@ -2,8 +2,10 @@ import { ActivityAccept } from '../../../../shared/models/activitypub'
2import { ActorModel } from '../../../models/activitypub/actor' 2import { ActorModel } from '../../../models/activitypub/actor'
3import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 3import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
4import { addFetchOutboxJob } from '../actor' 4import { addFetchOutboxJob } from '../actor'
5import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
5 6
6async function processAcceptActivity (activity: ActivityAccept, targetActor: ActorModel, inboxActor?: ActorModel) { 7async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
8 const { byActor: targetActor, inboxActor } = options
7 if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.') 9 if (inboxActor === undefined) throw new Error('Need to accept on explicit inbox.')
8 10
9 return processAccept(inboxActor, targetActor) 11 return processAccept(inboxActor, targetActor)
diff --git a/server/lib/activitypub/process/process-announce.ts b/server/lib/activitypub/process/process-announce.ts
index 1fe347506..7a59bb84d 100644
--- a/server/lib/activitypub/process/process-announce.ts
+++ b/server/lib/activitypub/process/process-announce.ts
@@ -8,9 +8,14 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
8import { Notifier } from '../../notifier' 8import { Notifier } from '../../notifier'
9import { VideoModel } from '../../../models/video/video' 9import { VideoModel } from '../../../models/video/video'
10import { logger } from '../../../helpers/logger' 10import { logger } from '../../../helpers/logger'
11import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
11 12
12async function processAnnounceActivity (activity: ActivityAnnounce, actorAnnouncer: ActorModel) { 13async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
13 return retryTransactionWrapper(processVideoShare, actorAnnouncer, activity) 14 const { activity, byActor: actorAnnouncer } = options
15 // Only notify if it is not from a fetcher job
16 const notify = options.fromFetch !== true
17
18 return retryTransactionWrapper(processVideoShare, actorAnnouncer, activity, notify)
14} 19}
15 20
16// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
@@ -21,7 +26,7 @@ export {
21 26
22// --------------------------------------------------------------------------- 27// ---------------------------------------------------------------------------
23 28
24async function processVideoShare (actorAnnouncer: ActorModel, activity: ActivityAnnounce) { 29async function processVideoShare (actorAnnouncer: ActorModel, activity: ActivityAnnounce, notify: boolean) {
25 const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id 30 const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id
26 31
27 let video: VideoModel 32 let video: VideoModel
@@ -63,5 +68,5 @@ async function processVideoShare (actorAnnouncer: ActorModel, activity: Activity
63 return undefined 68 return undefined
64 }) 69 })
65 70
66 if (videoCreated) Notifier.Instance.notifyOnNewVideoIfNeeded(video) 71 if (videoCreated && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video)
67} 72}
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index 1e893cdeb..a979771b6 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -12,17 +12,22 @@ import { Notifier } from '../../notifier'
12import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' 12import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
13import { createOrUpdateVideoPlaylist } from '../playlist' 13import { createOrUpdateVideoPlaylist } from '../playlist'
14import { VideoModel } from '../../../models/video/video' 14import { VideoModel } from '../../../models/video/video'
15import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
15 16
16async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { 17async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) {
18 const { activity, byActor } = options
19
20 // Only notify if it is not from a fetcher job
21 const notify = options.fromFetch !== true
17 const activityObject = activity.object 22 const activityObject = activity.object
18 const activityType = activityObject.type 23 const activityType = activityObject.type
19 24
20 if (activityType === 'Video') { 25 if (activityType === 'Video') {
21 return processCreateVideo(activity) 26 return processCreateVideo(activity, notify)
22 } 27 }
23 28
24 if (activityType === 'Note') { 29 if (activityType === 'Note') {
25 return retryTransactionWrapper(processCreateVideoComment, activity, byActor) 30 return retryTransactionWrapper(processCreateVideoComment, activity, byActor, notify)
26 } 31 }
27 32
28 if (activityType === 'CacheFile') { 33 if (activityType === 'CacheFile') {
@@ -45,12 +50,12 @@ export {
45 50
46// --------------------------------------------------------------------------- 51// ---------------------------------------------------------------------------
47 52
48async function processCreateVideo (activity: ActivityCreate) { 53async function processCreateVideo (activity: ActivityCreate, notify: boolean) {
49 const videoToCreateData = activity.object as VideoTorrentObject 54 const videoToCreateData = activity.object as VideoTorrentObject
50 55
51 const { video, created } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoToCreateData }) 56 const { video, created } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoToCreateData })
52 57
53 if (created) Notifier.Instance.notifyOnNewVideoIfNeeded(video) 58 if (created && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video)
54 59
55 return video 60 return video
56} 61}
@@ -71,7 +76,7 @@ async function processCreateCacheFile (activity: ActivityCreate, byActor: ActorM
71 } 76 }
72} 77}
73 78
74async function processCreateVideoComment (activity: ActivityCreate, byActor: ActorModel) { 79async function processCreateVideoComment (activity: ActivityCreate, byActor: ActorModel, notify: boolean) {
75 const commentObject = activity.object as VideoCommentObject 80 const commentObject = activity.object as VideoCommentObject
76 const byAccount = byActor.Account 81 const byAccount = byActor.Account
77 82
@@ -99,7 +104,7 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: Act
99 await forwardVideoRelatedActivity(activity, undefined, exceptions, video) 104 await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
100 } 105 }
101 106
102 if (created === true) Notifier.Instance.notifyOnNewComment(comment) 107 if (created && notify) Notifier.Instance.notifyOnNewComment(comment)
103} 108}
104 109
105async function processCreatePlaylist (activity: ActivityCreate, byActor: ActorModel) { 110async function processCreatePlaylist (activity: ActivityCreate, byActor: ActorModel) {
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts
index 6f10a50bd..845a7b249 100644
--- a/server/lib/activitypub/process/process-delete.ts
+++ b/server/lib/activitypub/process/process-delete.ts
@@ -9,8 +9,11 @@ import { VideoChannelModel } from '../../../models/video/video-channel'
9import { VideoCommentModel } from '../../../models/video/video-comment' 9import { VideoCommentModel } from '../../../models/video/video-comment'
10import { forwardVideoRelatedActivity } from '../send/utils' 10import { forwardVideoRelatedActivity } from '../send/utils'
11import { VideoPlaylistModel } from '../../../models/video/video-playlist' 11import { VideoPlaylistModel } from '../../../models/video/video-playlist'
12import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
13
14async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {
15 const { activity, byActor } = options
12 16
13async function processDeleteActivity (activity: ActivityDelete, byActor: ActorModel) {
14 const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id 17 const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
15 18
16 if (activity.actor === objectUrl) { 19 if (activity.actor === objectUrl) {
diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts
index f06269f8b..a457e5f17 100644
--- a/server/lib/activitypub/process/process-dislike.ts
+++ b/server/lib/activitypub/process/process-dislike.ts
@@ -7,8 +7,10 @@ import { ActorModel } from '../../../models/activitypub/actor'
7import { getOrCreateVideoAndAccountAndChannel } from '../videos' 7import { getOrCreateVideoAndAccountAndChannel } from '../videos'
8import { forwardVideoRelatedActivity } from '../send/utils' 8import { forwardVideoRelatedActivity } from '../send/utils'
9import { getVideoDislikeActivityPubUrl } from '../url' 9import { getVideoDislikeActivityPubUrl } from '../url'
10import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
10 11
11async function processDislikeActivity (activity: ActivityCreate | ActivityDislike, byActor: ActorModel) { 12async function processDislikeActivity (options: APProcessorOptions<ActivityCreate | ActivityDislike>) {
13 const { activity, byActor } = options
12 return retryTransactionWrapper(processDislike, activity, byActor) 14 return retryTransactionWrapper(processDislike, activity, byActor)
13} 15}
14 16
diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts
index 8faab051e..532545e58 100644
--- a/server/lib/activitypub/process/process-flag.ts
+++ b/server/lib/activitypub/process/process-flag.ts
@@ -8,8 +8,10 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse'
8import { getOrCreateVideoAndAccountAndChannel } from '../videos' 8import { getOrCreateVideoAndAccountAndChannel } from '../videos'
9import { Notifier } from '../../notifier' 9import { Notifier } from '../../notifier'
10import { getAPId } from '../../../helpers/activitypub' 10import { getAPId } from '../../../helpers/activitypub'
11import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
11 12
12async function processFlagActivity (activity: ActivityCreate | ActivityFlag, byActor: ActorModel) { 13async function processFlagActivity (options: APProcessorOptions<ActivityCreate | ActivityFlag>) {
14 const { activity, byActor } = options
13 return retryTransactionWrapper(processCreateVideoAbuse, activity, byActor) 15 return retryTransactionWrapper(processCreateVideoAbuse, activity, byActor)
14} 16}
15 17
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index ed16ba172..8fe9975f6 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -9,8 +9,10 @@ import { Notifier } from '../../notifier'
9import { getAPId } from '../../../helpers/activitypub' 9import { getAPId } from '../../../helpers/activitypub'
10import { getServerActor } from '../../../helpers/utils' 10import { getServerActor } from '../../../helpers/utils'
11import { CONFIG } from '../../../initializers/config' 11import { CONFIG } from '../../../initializers/config'
12import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
12 13
13async function processFollowActivity (activity: ActivityFollow, byActor: ActorModel) { 14async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {
15 const { activity, byActor } = options
14 const activityObject = getAPId(activity.object) 16 const activityObject = getAPId(activity.object)
15 17
16 return retryTransactionWrapper(processFollow, byActor, activityObject) 18 return retryTransactionWrapper(processFollow, byActor, activityObject)
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts
index bba54a19b..706e63c41 100644
--- a/server/lib/activitypub/process/process-like.ts
+++ b/server/lib/activitypub/process/process-like.ts
@@ -7,8 +7,10 @@ import { forwardVideoRelatedActivity } from '../send/utils'
7import { getOrCreateVideoAndAccountAndChannel } from '../videos' 7import { getOrCreateVideoAndAccountAndChannel } from '../videos'
8import { getVideoLikeActivityPubUrl } from '../url' 8import { getVideoLikeActivityPubUrl } from '../url'
9import { getAPId } from '../../../helpers/activitypub' 9import { getAPId } from '../../../helpers/activitypub'
10import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
10 11
11async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { 12async function processLikeActivity (options: APProcessorOptions<ActivityLike>) {
13 const { activity, byActor } = options
12 return retryTransactionWrapper(processLikeVideo, byActor, activity) 14 return retryTransactionWrapper(processLikeVideo, byActor, activity)
13} 15}
14 16
diff --git a/server/lib/activitypub/process/process-reject.ts b/server/lib/activitypub/process/process-reject.ts
index 709a65096..9181906b4 100644
--- a/server/lib/activitypub/process/process-reject.ts
+++ b/server/lib/activitypub/process/process-reject.ts
@@ -2,8 +2,10 @@ import { ActivityReject } from '../../../../shared/models/activitypub/activity'
2import { sequelizeTypescript } from '../../../initializers' 2import { sequelizeTypescript } from '../../../initializers'
3import { ActorModel } from '../../../models/activitypub/actor' 3import { ActorModel } from '../../../models/activitypub/actor'
4import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 4import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
5import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
5 6
6async function processRejectActivity (activity: ActivityReject, targetActor: ActorModel, inboxActor?: ActorModel) { 7async function processRejectActivity (options: APProcessorOptions<ActivityReject>) {
8 const { byActor: targetActor, inboxActor } = options
7 if (inboxActor === undefined) throw new Error('Need to reject on explicit inbox.') 9 if (inboxActor === undefined) throw new Error('Need to reject on explicit inbox.')
8 10
9 return processReject(inboxActor, targetActor) 11 return processReject(inboxActor, targetActor)
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts
index 692c51904..7a0f90adf 100644
--- a/server/lib/activitypub/process/process-undo.ts
+++ b/server/lib/activitypub/process/process-undo.ts
@@ -10,8 +10,10 @@ import { forwardVideoRelatedActivity } from '../send/utils'
10import { getOrCreateVideoAndAccountAndChannel } from '../videos' 10import { getOrCreateVideoAndAccountAndChannel } from '../videos'
11import { VideoShareModel } from '../../../models/video/video-share' 11import { VideoShareModel } from '../../../models/video/video-share'
12import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' 12import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
13import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
13 14
14async function processUndoActivity (activity: ActivityUndo, byActor: ActorModel) { 15async function processUndoActivity (options: APProcessorOptions<ActivityUndo>) {
16 const { activity, byActor } = options
15 const activityToUndo = activity.object 17 const activityToUndo = activity.object
16 18
17 if (activityToUndo.type === 'Like') { 19 if (activityToUndo.type === 'Like') {
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index 71a16dacc..1e11dd1fd 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -14,8 +14,11 @@ import { createOrUpdateCacheFile } from '../cache-file'
14import { forwardVideoRelatedActivity } from '../send/utils' 14import { forwardVideoRelatedActivity } from '../send/utils'
15import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' 15import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
16import { createOrUpdateVideoPlaylist } from '../playlist' 16import { createOrUpdateVideoPlaylist } from '../playlist'
17import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
18
19async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
20 const { activity, byActor } = options
17 21
18async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) {
19 const objectType = activity.object.type 22 const objectType = activity.object.type
20 23
21 if (objectType === 'Video') { 24 if (objectType === 'Video') {
diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts
index 8f66d3630..0170b74f4 100644
--- a/server/lib/activitypub/process/process-view.ts
+++ b/server/lib/activitypub/process/process-view.ts
@@ -3,8 +3,10 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
3import { forwardVideoRelatedActivity } from '../send/utils' 3import { forwardVideoRelatedActivity } from '../send/utils'
4import { Redis } from '../../redis' 4import { Redis } from '../../redis'
5import { ActivityCreate, ActivityView, ViewObject } from '../../../../shared/models/activitypub' 5import { ActivityCreate, ActivityView, ViewObject } from '../../../../shared/models/activitypub'
6import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
6 7
7async function processViewActivity (activity: ActivityView | ActivityCreate, byActor: ActorModel) { 8async function processViewActivity (options: APProcessorOptions<ActivityCreate | ActivityView>) {
9 const { activity, byActor } = options
8 return processCreateView(activity, byActor) 10 return processCreateView(activity, byActor)
9} 11}
10 12
diff --git a/server/lib/activitypub/process/process.ts b/server/lib/activitypub/process/process.ts
index 9dd241402..f4a92e341 100644
--- a/server/lib/activitypub/process/process.ts
+++ b/server/lib/activitypub/process/process.ts
@@ -15,8 +15,9 @@ import { getOrCreateActorAndServerAndModel } from '../actor'
15import { processDislikeActivity } from './process-dislike' 15import { processDislikeActivity } from './process-dislike'
16import { processFlagActivity } from './process-flag' 16import { processFlagActivity } from './process-flag'
17import { processViewActivity } from './process-view' 17import { processViewActivity } from './process-view'
18import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
18 19
19const processActivity: { [ P in ActivityType ]: (activity: Activity, byActor: ActorModel, inboxActor?: ActorModel) => Promise<any> } = { 20const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Activity>) => Promise<any> } = {
20 Create: processCreateActivity, 21 Create: processCreateActivity,
21 Update: processUpdateActivity, 22 Update: processUpdateActivity,
22 Delete: processDeleteActivity, 23 Delete: processDeleteActivity,
@@ -37,11 +38,15 @@ async function processActivities (
37 signatureActor?: ActorModel 38 signatureActor?: ActorModel
38 inboxActor?: ActorModel 39 inboxActor?: ActorModel
39 outboxUrl?: string 40 outboxUrl?: string
40 } = {}) { 41 fromFetch?: boolean
42 } = {}
43) {
44 const { outboxUrl, signatureActor, inboxActor, fromFetch = false } = options
45
41 const actorsCache: { [ url: string ]: ActorModel } = {} 46 const actorsCache: { [ url: string ]: ActorModel } = {}
42 47
43 for (const activity of activities) { 48 for (const activity of activities) {
44 if (!options.signatureActor && [ 'Create', 'Announce', 'Like' ].includes(activity.type) === false) { 49 if (!signatureActor && [ 'Create', 'Announce', 'Like' ].includes(activity.type) === false) {
45 logger.error('Cannot process activity %s (type: %s) without the actor signature.', activity.id, activity.type) 50 logger.error('Cannot process activity %s (type: %s) without the actor signature.', activity.id, activity.type)
46 continue 51 continue
47 } 52 }
@@ -49,17 +54,17 @@ async function processActivities (
49 const actorUrl = getAPId(activity.actor) 54 const actorUrl = getAPId(activity.actor)
50 55
51 // When we fetch remote data, we don't have signature 56 // When we fetch remote data, we don't have signature
52 if (options.signatureActor && actorUrl !== options.signatureActor.url) { 57 if (signatureActor && actorUrl !== signatureActor.url) {
53 logger.warn('Signature mismatch between %s and %s, skipping.', actorUrl, options.signatureActor.url) 58 logger.warn('Signature mismatch between %s and %s, skipping.', actorUrl, signatureActor.url)
54 continue 59 continue
55 } 60 }
56 61
57 if (options.outboxUrl && checkUrlsSameHost(options.outboxUrl, actorUrl) !== true) { 62 if (outboxUrl && checkUrlsSameHost(outboxUrl, actorUrl) !== true) {
58 logger.warn('Host mismatch between outbox URL %s and actor URL %s, skipping.', options.outboxUrl, actorUrl) 63 logger.warn('Host mismatch between outbox URL %s and actor URL %s, skipping.', outboxUrl, actorUrl)
59 continue 64 continue
60 } 65 }
61 66
62 const byActor = options.signatureActor || actorsCache[actorUrl] || await getOrCreateActorAndServerAndModel(actorUrl) 67 const byActor = signatureActor || actorsCache[actorUrl] || await getOrCreateActorAndServerAndModel(actorUrl)
63 actorsCache[actorUrl] = byActor 68 actorsCache[actorUrl] = byActor
64 69
65 const activityProcessor = processActivity[activity.type] 70 const activityProcessor = processActivity[activity.type]
@@ -69,7 +74,7 @@ async function processActivities (
69 } 74 }
70 75
71 try { 76 try {
72 await activityProcessor(activity, byActor, options.inboxActor) 77 await activityProcessor({ activity, byActor, inboxActor: inboxActor, fromFetch })
73 } catch (err) { 78 } catch (err) {
74 logger.warn('Cannot process activity %s.', activity.type, { err }) 79 logger.warn('Cannot process activity %s.', activity.type, { err })
75 } 80 }
diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
index 23d33c26f..4da645f07 100644
--- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
@@ -33,7 +33,7 @@ async function processActivityPubHttpFetcher (job: Bull.Job) {
33 if (payload.accountId) account = await AccountModel.load(payload.accountId) 33 if (payload.accountId) account = await AccountModel.load(payload.accountId)
34 34
35 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = { 35 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = {
36 'activity': items => processActivities(items, { outboxUrl: payload.uri }), 36 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }),
37 'video-likes': items => createRates(items, video, 'like'), 37 'video-likes': items => createRates(items, video, 'like'),
38 'video-dislikes': items => createRates(items, video, 'dislike'), 38 'video-dislikes': items => createRates(items, video, 'dislike'),
39 'video-shares': items => addVideoShares(items, video), 39 'video-shares': items => addVideoShares(items, video),
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index c9beae268..444162a03 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -408,9 +408,7 @@ export class PluginManager implements ServerHook {
408 private async regeneratePluginGlobalCSS () { 408 private async regeneratePluginGlobalCSS () {
409 await this.resetCSSGlobalFile() 409 await this.resetCSSGlobalFile()
410 410
411 for (const key of Object.keys(this.getRegisteredPlugins())) { 411 for (const plugin of this.getRegisteredPlugins()) {
412 const plugin = this.registeredPlugins[key]
413
414 await this.addCSSToGlobalFile(plugin.path, plugin.css) 412 await this.addCSSToGlobalFile(plugin.path, plugin.css)
415 } 413 }
416 } 414 }
diff --git a/server/typings/activitypub-processor.model.ts b/server/typings/activitypub-processor.model.ts
new file mode 100644
index 000000000..7c70251ca
--- /dev/null
+++ b/server/typings/activitypub-processor.model.ts
@@ -0,0 +1,9 @@
1import { Activity } from '../../shared/models/activitypub'
2import { ActorModel } from '../models/activitypub/actor'
3
4export type APProcessorOptions<T extends Activity> = {
5 activity: T
6 byActor: ActorModel
7 inboxActor?: ActorModel
8 fromFetch?: boolean
9}