@evanp/activitypub-bot 0.45.16 → 0.45.17

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,19 @@ and this project adheres to
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.45.17] - 2026-05-11
13
+
14
+ ### Changed
15
+
16
+ - Bumped activitypub-nock.
17
+
18
+ ### Fixed
19
+
20
+ - Look up id in results body even if the the id is not a fragment; fixes
21
+ problems with gotosocial keys.
22
+ - Retry signature code on more HTTP status
23
+ results, for servers that use (wrong, bad) 400, 404 and 410 results for bad signatures.
24
+
12
25
  ## [0.45.16] - 2026-05-11
13
26
 
14
27
  ### Changed
@@ -24,6 +24,8 @@ const COLLECTION_TYPES = [
24
24
  `${NS}OrderedCollection`
25
25
  ]
26
26
 
27
+ const SIG_ERROR_STATUS = [400, 401, 403, 404, 410]
28
+
27
29
  function normalizeHeaders (headers) {
28
30
  if (!headers) {
29
31
  return headers
@@ -120,7 +122,7 @@ export class ActivityPubClient {
120
122
  try {
121
123
  obj = await this.#get(url, this.#urlFormatter.hostname, false, false)
122
124
  } catch (err) {
123
- if (err.status && [401, 403, 404].includes(err.status)) {
125
+ if (err.status && SIG_ERROR_STATUS.includes(err.status)) {
124
126
  obj = await this.#get(url, this.#urlFormatter.hostname, true, false)
125
127
  } else {
126
128
  throw err
@@ -205,7 +207,7 @@ export class ActivityPubClient {
205
207
  }
206
208
  )
207
209
  this.#logger.debug({ hostname, status: res.status }, 'response received')
208
- if ([400, 401, 403].includes(res.status) &&
210
+ if (SIG_ERROR_STATUS.includes(res.status) &&
209
211
  sign &&
210
212
  lastPolicy === SignaturePolicyStorage.RFC9421) {
211
213
  const errBody = await res.text()
@@ -279,7 +281,9 @@ export class ActivityPubClient {
279
281
  this.#logger.warn({ url: baseUrl, json }, 'Error importing JSON as AS2')
280
282
  throw err
281
283
  }
282
- const resolved = (parsed.hash)
284
+ // NB: should only test for fragments,
285
+ // but e.g. gotosocial has this.
286
+ const resolved = (obj.id !== url)
283
287
  ? this.#resolveObject(obj, url)
284
288
  : obj
285
289
  return resolved
@@ -345,7 +349,7 @@ export class ActivityPubClient {
345
349
  body
346
350
  }
347
351
  )
348
- if ([400, 401, 403].includes(res.status) &&
352
+ if (SIG_ERROR_STATUS.includes(res.status) &&
349
353
  lastPolicy === SignaturePolicyStorage.RFC9421) {
350
354
  const errBody = await res.text()
351
355
  this.#logger.debug(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanp/activitypub-bot",
3
- "version": "0.45.16",
3
+ "version": "0.45.17",
4
4
  "description": "server-side ActivityPub bot framework",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -45,7 +45,7 @@
45
45
  "sequelize": "^6.37.7"
46
46
  },
47
47
  "devDependencies": {
48
- "@evanp/activitypub-nock": "^0.9.4",
48
+ "@evanp/activitypub-nock": "^0.9.5",
49
49
  "eslint": "^8.57.1",
50
50
  "eslint-config-standard": "^17.1.0",
51
51
  "eslint-plugin-import": "^2.29.1",