@evanp/activitypub-bot 0.45.1 → 0.45.3

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,21 @@ and this project adheres to
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.45.3] - 2026-04-24
13
+
14
+ ### Fixed
15
+
16
+ - Correct summary for Announce activities
17
+
18
+ ## [0.45.2] - 2026-04-24
19
+
20
+ ### Fixed
21
+
22
+ - Only send activities with `actor` property as a bare URI,
23
+ not an embedded object. Fixes interoperability with Misskey.
24
+ - Explicitly set `manuallyApprovesFollowers` to false. Fixes
25
+ (some) interoperability with Pixelfed.
26
+
12
27
  ## [0.45.1] - 2026-04-23
13
28
 
14
29
  ### Fixed
@@ -912,11 +912,7 @@ export class ActivityHandler {
912
912
  const activity = await as2.import({
913
913
  ...activityData,
914
914
  id: this.#formatActivityId(bot, activityData.type),
915
- actor: {
916
- id: this.#botId(bot),
917
- name: bot.fullname,
918
- type: bot.type
919
- },
915
+ actor: this.#botId(bot),
920
916
  published: now,
921
917
  updated: now
922
918
  })
@@ -406,4 +406,23 @@ as2.registerContext('https://purl.archive.org/socialweb/webfinger', {
406
406
  }
407
407
  })
408
408
 
409
+ as2.registerContext('https://purl.archive.org/miscellany', {
410
+ '@context': {
411
+ as: 'https://www.w3.org/ns/activitystreams#',
412
+ xsd: 'http://www.w3.org/2001/XMLSchema#',
413
+ Hashtag: 'as:Hashtag',
414
+ manuallyApprovesFollowers: {
415
+ '@id': 'as:manuallyApprovesFollowers',
416
+ '@type': 'xsd:boolean'
417
+ },
418
+ movedTo: {
419
+ '@id': 'as:movedTo',
420
+ '@type': '@id'
421
+ },
422
+ sensitive: {
423
+ '@id': 'as:sensitive',
424
+ '@type': 'xsd:boolean'
425
+ }
426
+ }
427
+ })
409
428
  export default as2
package/lib/botcontext.js CHANGED
@@ -10,6 +10,8 @@ const AS2_TYPES = [
10
10
  'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
11
11
  ]
12
12
 
13
+ const AS2_NS = 'https://www.w3.org/ns/activitystreams#'
14
+
13
15
  const WF_NS = 'https://purl.archive.org/socialweb/webfinger#'
14
16
 
15
17
  const THREAD_PROP = 'https://purl.archive.org/socialweb/thread#thread'
@@ -558,7 +560,13 @@ export class BotContext {
558
560
  } else if (obj.summary) {
559
561
  return obj.summary.get()
560
562
  } else if (obj.type) {
561
- return `a(n) ${obj.type.first}`
563
+ const type = (Array.isArray(obj.type))
564
+ ? obj.type[0]
565
+ : obj.type
566
+ const shortType = (type.startsWith(AS2_NS))
567
+ ? type.slice(AS2_NS.length)
568
+ : type
569
+ return `a(n) ${shortType}`
562
570
  } else {
563
571
  return 'an object'
564
572
  }
@@ -575,9 +583,7 @@ export class BotContext {
575
583
  type,
576
584
  nanoid: nanoid()
577
585
  }),
578
- actor: {
579
- id: this.#formatter.format({ username: this.#botId })
580
- },
586
+ actor: this.#formatter.format({ username: this.#botId }),
581
587
  published: now,
582
588
  updated: now
583
589
  }
@@ -37,7 +37,8 @@ router.get('/user/:username', async (req, res, next) => {
37
37
  '@context': [
38
38
  'https://www.w3.org/ns/activitystreams',
39
39
  'https://w3id.org/security/v1',
40
- 'https://purl.archive.org/socialweb/webfinger'
40
+ 'https://purl.archive.org/socialweb/webfinger',
41
+ 'https://purl.archive.org/miscellany'
41
42
  ],
42
43
  id: formatter.format({ username }),
43
44
  type: bot.type,
@@ -67,7 +68,8 @@ router.get('/user/:username', async (req, res, next) => {
67
68
  href: formatter.format({ username, type: 'profile' }),
68
69
  type: 'Link',
69
70
  mediaType: 'text/html'
70
- }
71
+ },
72
+ manuallyApprovesFollowers: false
71
73
  })
72
74
  res.status(200)
73
75
  res.type(as2.mediaType)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanp/activitypub-bot",
3
- "version": "0.45.1",
3
+ "version": "0.45.3",
4
4
  "description": "server-side ActivityPub bot framework",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",