aboutsummaryrefslogtreecommitdiffstats
path: root/index.ts
diff options
context:
space:
mode:
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);