aboutsummaryrefslogtreecommitdiffstats
path: root/index.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-06 23:22:12 -0800
committerAdam Soltys <[email protected]>2026-03-06 23:22:12 -0800
commit4237e418f7332f9edfad30964d2d6a51aa6c1db2 (patch)
tree03c25a7997519c0f95644f82aaffdc095ff76778 /index.ts
parent8ec62a53ad1516f8ed2554a026053977db18c62d (diff)
downloadcoinos-server-4237e418f7332f9edfad30964d2d6a51aa6c1db2.tar.gz
coinos-server-4237e418f7332f9edfad30964d2d6a51aa6c1db2.zip
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 <[email protected]>
Diffstat (limited to 'index.ts')
-rw-r--r--index.ts13
1 files changed, 12 insertions, 1 deletions
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);