diff options
Diffstat (limited to 'server/lib/activitypub/actor.ts')
-rw-r--r-- | server/lib/activitypub/actor.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 4c336f26e..f27733418 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -19,6 +19,8 @@ import { ActorModel } from '../../models/activitypub/actor' | |||
19 | import { AvatarModel } from '../../models/avatar/avatar' | 19 | import { AvatarModel } from '../../models/avatar/avatar' |
20 | import { ServerModel } from '../../models/server/server' | 20 | import { ServerModel } from '../../models/server/server' |
21 | import { VideoChannelModel } from '../../models/video/video-channel' | 21 | import { VideoChannelModel } from '../../models/video/video-channel' |
22 | import { JobQueue } from '../job-queue' | ||
23 | import { getServerActor } from '../../helpers/utils' | ||
22 | 24 | ||
23 | // Set account keys, this could be long so process after the account creation and do not block the client | 25 | // Set account keys, this could be long so process after the account creation and do not block the client |
24 | function setAsyncActorKeys (actor: ActorModel) { | 26 | function setAsyncActorKeys (actor: ActorModel) { |
@@ -169,6 +171,21 @@ async function fetchAvatarIfExists (actorJSON: ActivityPubActor) { | |||
169 | return undefined | 171 | return undefined |
170 | } | 172 | } |
171 | 173 | ||
174 | async function addFetchOutboxJob (actor: ActorModel) { | ||
175 | // Don't fetch ourselves | ||
176 | const serverActor = await getServerActor() | ||
177 | if (serverActor.id === actor.id) { | ||
178 | logger.error('Cannot fetch our own outbox!') | ||
179 | return undefined | ||
180 | } | ||
181 | |||
182 | const payload = { | ||
183 | uris: [ actor.outboxUrl ] | ||
184 | } | ||
185 | |||
186 | return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) | ||
187 | } | ||
188 | |||
172 | export { | 189 | export { |
173 | getOrCreateActorAndServerAndModel, | 190 | getOrCreateActorAndServerAndModel, |
174 | buildActorInstance, | 191 | buildActorInstance, |
@@ -176,7 +193,8 @@ export { | |||
176 | fetchActorTotalItems, | 193 | fetchActorTotalItems, |
177 | fetchAvatarIfExists, | 194 | fetchAvatarIfExists, |
178 | updateActorInstance, | 195 | updateActorInstance, |
179 | updateActorAvatarInstance | 196 | updateActorAvatarInstance, |
197 | addFetchOutboxJob | ||
180 | } | 198 | } |
181 | 199 | ||
182 | // --------------------------------------------------------------------------- | 200 | // --------------------------------------------------------------------------- |