From 5a19bf62fdaa43412f8bf8402f66ea316acc82d6 Mon Sep 17 00:00:00 2001 From: ntr Date: Sun, 27 Nov 2022 15:08:59 +1100 Subject: [PATCH] adminconnection --- api/src/rpc.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/src/rpc.ts b/api/src/rpc.ts index b1bb7c1..b3414f2 100644 --- a/api/src/rpc.ts +++ b/api/src/rpc.ts @@ -109,7 +109,18 @@ export default function createRpc(log: Log, pg: Pg, user: User, ws, discogs, off throw new Error(`Invalid parameters for message type ${msgType}: ${JSON.stringify(message)}`); } + async function anonConnection() { + + } + + async function adminConnection() { + // don't need it, requested on route + // send(await acpOffers()); + } + async function onConnection() { + if (!user) return anonConnection(); + const userMsg: UserMessage = [RpcMessageType.User, user]; send(userMsg); @@ -120,6 +131,8 @@ export default function createRpc(log: Log, pg: Pg, user: User, ws, discogs, off const wants = await pg.userWants(user); const wantsMsg: WantsMessage = [RpcMessageType.Wants, wants]; send(wantsMsg); + + if (isAdmin(user)) return adminConnection(); } function send(msg: RpcMessage) {