Compare commits
2 commits
e3f35f5525
...
6376597857
Author | SHA1 | Date | |
---|---|---|---|
|
6376597857 | ||
|
0f3154745e |
1 changed files with 5 additions and 1 deletions
|
@ -90,6 +90,10 @@ class GatewayHandler {
|
|||
}
|
||||
|
||||
handleConnection(ws) {
|
||||
if (!policies.allowGatewayConnection) {
|
||||
return ws.close(wsCloseCodes.SERVER_DENIED_CONNECTION[0], wsCloseCodes.SERVER_DENIED_CONNECTION[1]);
|
||||
}
|
||||
|
||||
const session = new GatewaySession();
|
||||
session.setWebsocketClient(ws);
|
||||
session.send("HELLO", { pingInterval: clientFacingPingInterval });
|
||||
|
@ -146,7 +150,7 @@ class GatewayHandler {
|
|||
|
||||
// Gateway message handlers
|
||||
async handle_YOO({ data }, session) {
|
||||
if (session.authenticated) return {error: wsCloseCodes.PAYLOAD_ERROR};
|
||||
if (session.authenticated || !Array.isArray(data.roles) || data.roles.length > 10 || data.roles.) return {error: wsCloseCodes.PAYLOAD_ERROR};
|
||||
try {
|
||||
if (!(await session.authenticateWithToken(data.token))) return {error: wsCloseCodes.AUTHENTICATION_ERROR};
|
||||
} catch(e) {
|
||||
|
|
Reference in a new issue