From 4237e418f7332f9edfad30964d2d6a51aa6c1db2 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Mar 2026 23:22:12 -0800 Subject: add group registry for MLS push notifications Server now tracks MLS groups (synced from clients) and subscribes to kind 445 events on group relays, sending push to all members except the sender. Registry persisted to Redis across restarts. Co-Authored-By: Claude Opus 4.6 --- index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'index.ts') diff --git a/index.ts b/index.ts index a6cfa3de..f557bba0 100644 --- a/index.ts +++ b/index.ts @@ -22,7 +22,7 @@ import { getFx } from "$lib/rates"; import { sendHeartbeat, websocket } from "$lib/sockets"; import { initTigerBeetle } from "$lib/tb"; import { startZmq } from "$lib/zmq"; -import { listenForDMs } from "$lib/dmNotifications"; +import { listenForDMs, syncGroupsAndSave } from "$lib/dmNotifications"; import { initMlsIndex } from "$lib/mls"; import ecash from "$routes/ecash"; @@ -194,6 +194,17 @@ app.get("/trust", auth, users.trust); app.post("/trust", auth, users.addTrust); app.post("/trust/delete", auth, users.deleteTrust); +app.post("/groups/sync", auth, async (c) => { + try { + const { groups } = await c.req.json(); + if (!Array.isArray(groups)) return c.json("invalid groups", 400); + await syncGroupsAndSave(groups); + return c.json({ ok: true }); + } catch (e: any) { + return c.json(e.message, 500); + } +}); + app.get("/subscriptions", auth, users.subscriptions); app.post("/subscription", auth, users.subscription); app.post("/subscription/delete", auth, users.deleteSubscription); -- cgit v1.2.3