@evanp/activitypub-bot 0.41.0 → 0.41.2

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.
@@ -87,11 +87,12 @@ const REDIS_URL = normalize(values['redis-url']) || process.env.REDIS_URL || und
87
87
  const TRUST_PROXY_RAW = normalize(values['trust-proxy']) || process.env.TRUST_PROXY
88
88
  const TRUST_PROXY = (() => {
89
89
  if (TRUST_PROXY_RAW == null) return undefined
90
- const bool = parseBoolean(TRUST_PROXY_RAW)
90
+ const trimmed = TRUST_PROXY_RAW.trim()
91
+ const num = Number.parseInt(trimmed, 10)
92
+ if (!Number.isNaN(num) && String(num) === trimmed) return num
93
+ const bool = parseBoolean(trimmed)
91
94
  if (bool !== undefined) return bool
92
- const num = Number.parseInt(TRUST_PROXY_RAW, 10)
93
- if (!Number.isNaN(num) && String(num) === TRUST_PROXY_RAW.trim()) return num
94
- return TRUST_PROXY_RAW
95
+ return trimmed
95
96
  })()
96
97
  const ALLOW_PRIVATE = values['allow-private'] ||
97
98
  ('ALLOW_PRIVATE' in process.env)
package/lib/safeagent.js CHANGED
@@ -27,7 +27,16 @@ export class SafeAgent extends https.Agent {
27
27
  if (isPrivateIP(address)) {
28
28
  return callback(new PrivateNetworkError(address))
29
29
  }
30
- super.createConnection({ ...options, hostname: address }, callback)
30
+ try {
31
+ const socket = super.createConnection({
32
+ ...options,
33
+ host: address,
34
+ servername: options.servername || options.hostname
35
+ })
36
+ callback(null, socket)
37
+ } catch (e) {
38
+ callback(e)
39
+ }
31
40
  })
32
41
  }
33
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanp/activitypub-bot",
3
- "version": "0.41.0",
3
+ "version": "0.41.2",
4
4
  "description": "server-side ActivityPub bot framework",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",