@goodandready/dsh-messenger-gateway 0.3.22 → 0.4.0
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/LICENSE +1 -1
- package/cordis.patch.yml +1 -1
- package/lib/adapters/discord.js +1 -1
- package/lib/adapters/slack.js +1 -1
- package/lib/adapters/telegram-inbound.js +141 -0
- package/lib/adapters/telegram.js +596 -712
- package/lib/alerts.js +104 -63
- package/lib/api-health.js +38 -0
- package/lib/artifacts.js +118 -118
- package/lib/ask.js +203 -152
- package/lib/client.js +1660 -1631
- package/lib/commands.js +126 -74
- package/lib/documents.js +1 -1
- package/lib/file-manager.js +27 -1
- package/lib/forum-mirror.js +105 -0
- package/lib/gateway-callbacks.js +187 -0
- package/lib/gateway-commands.js +584 -0
- package/lib/gateway-turn.js +285 -0
- package/lib/gateway.js +58 -1240
- package/lib/http.js +12 -1
- package/lib/index.js +540 -532
- package/lib/integrations.js +1 -1
- package/lib/media.js +1 -9
- package/lib/models.js +6 -3
- package/lib/outbound.js +1 -1
- package/lib/pairing.js +8 -4
- package/lib/personas.js +8 -4
- package/lib/photos.js +1 -1
- package/lib/scheduler.js +169 -159
- package/lib/stream.js +115 -115
- package/lib/telegram-errors.js +0 -0
- package/lib/topics.js +0 -14
- package/lib/tts.js +0 -10
- package/lib/voice-prefs.js +8 -4
- package/package.json +69 -65
package/lib/http.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { timingSafeEqual } from 'node:crypto'
|
|
2
|
+
|
|
1
3
|
export async function readBody(req) {
|
|
2
4
|
const chunks = []
|
|
3
5
|
for await (const chunk of req) chunks.push(chunk)
|
|
@@ -15,4 +17,13 @@ export function isTrustedSettingsRequest(req) {
|
|
|
15
17
|
const host = String(req.headers?.host || '')
|
|
16
18
|
if (!origin || !host) return false
|
|
17
19
|
try { return new URL(origin).host === host } catch { return false }
|
|
18
|
-
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function timingSafeCompare(a, b) {
|
|
23
|
+
if (typeof a !== 'string' || typeof b !== 'string') return false
|
|
24
|
+
const bufA = Buffer.from(a, 'utf8')
|
|
25
|
+
const bufB = Buffer.from(b, 'utf8')
|
|
26
|
+
if (bufA.length !== bufB.length) return false
|
|
27
|
+
return timingSafeEqual(bufA, bufB)
|
|
28
|
+
}
|
|
29
|
+
|