@evanp/activitypub-bot 0.13.10 → 0.13.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,6 +50,13 @@ export class ActivityDeliverer {
50
50
  }
51
51
 
52
52
  async deliverTo (activity, bot) {
53
+ if (await this.#actorStorage.isInCollection(bot.username, 'inbox', activity)) {
54
+ this.#logger.info(
55
+ { activity: activity.id, username: bot.username },
56
+ 'skipping redelivery for activity already in the inbox'
57
+ )
58
+ return
59
+ }
53
60
  try {
54
61
  await this.#activityHandler.handleActivity(bot, activity)
55
62
  } catch (err) {
@@ -136,7 +136,7 @@ export class ActivityHandler {
136
136
  type: 'add',
137
137
  nanoid: nanoid()
138
138
  }),
139
- actor: original.actor,
139
+ actor: await this.#botActor(bot),
140
140
  object,
141
141
  target: original.replies,
142
142
  ...recipients
@@ -299,7 +299,7 @@ export class ActivityHandler {
299
299
  await this.#doActivity(bot, await as2.import({
300
300
  id: addActivityId,
301
301
  type: 'Add',
302
- actor: this.#formatter.format({ username: bot.username }),
302
+ actor: await this.#botActor(bot),
303
303
  object: actor,
304
304
  target: this.#formatter.format({
305
305
  username: bot.username,
@@ -386,7 +386,7 @@ export class ActivityHandler {
386
386
  nanoid: nanoid()
387
387
  }),
388
388
  type: 'Add',
389
- actor: this.#formatter.format({ username: bot.username }),
389
+ actor: await this.#botActor(bot),
390
390
  object: actor,
391
391
  target: this.#formatter.format({
392
392
  username: bot.username,
@@ -517,7 +517,7 @@ export class ActivityHandler {
517
517
  type: 'add',
518
518
  nanoid: nanoid()
519
519
  }),
520
- actor: this.#botId(bot),
520
+ actor: await this.#botActor(bot),
521
521
  object: activity,
522
522
  target: this.#formatter.format({
523
523
  username: bot.username,
@@ -594,7 +594,7 @@ export class ActivityHandler {
594
594
  type: 'add',
595
595
  nanoid: nanoid()
596
596
  }),
597
- actor: this.#botId(bot),
597
+ actor: await this.#botActor(bot),
598
598
  object: activity,
599
599
  target: this.#formatter.format({
600
600
  username: bot.username,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanp/activitypub-bot",
3
- "version": "0.13.10",
3
+ "version": "0.13.12",
4
4
  "description": "server-side ActivityPub bot framework",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",