adminconnection
This commit is contained in:
1 parent
e185d04039
commit
5a19bf62fd
1 file changed
+13
@@ -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)}`);
|
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() {
|
async function onConnection() {
|
||||||
|
if (!user) return anonConnection();
|
||||||
|
|
||||||
const userMsg: UserMessage = [RpcMessageType.User, user];
|
const userMsg: UserMessage = [RpcMessageType.User, user];
|
||||||
send(userMsg);
|
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 wants = await pg.userWants(user);
|
||||||
const wantsMsg: WantsMessage = [RpcMessageType.Wants, wants];
|
const wantsMsg: WantsMessage = [RpcMessageType.Wants, wants];
|
||||||
send(wantsMsg);
|
send(wantsMsg);
|
||||||
|
|
||||||
|
if (isAdmin(user)) return adminConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
function send(msg: RpcMessage) {
|
function send(msg: RpcMessage) {
|
||||||
|
|||||||
Reference in new issue
Block a user