Created dedicated queue broadcast namespace, to make authorized queue broadcasts as painless as possible.
This commit is contained in:
parent
e88ef29852
commit
5eb307bb9e
9 changed files with 131 additions and 9 deletions
|
|
@ -51,21 +51,30 @@ class auxServer{
|
|||
* Handles global server-side initialization for new connections to aux server
|
||||
* @param {Socket} socket - Requesting Socket
|
||||
*/
|
||||
async handleConnection(socket){
|
||||
async handleConnection(socket, lite = true){
|
||||
try{
|
||||
//Define empty value to hold result
|
||||
let result = null;
|
||||
|
||||
//ensure unbanned ip and valid CSRF token
|
||||
if(!(await socketUtils.validateSocket(socket))){
|
||||
socket.disconnect();
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if(lite){
|
||||
result = await socketUtils.authSocketLite(socket);
|
||||
}else{
|
||||
result = await socketUtils.authSocket(socket);
|
||||
}
|
||||
|
||||
//If the socket wasn't authorized
|
||||
if(await socketUtils.authSocketLite(socket) == null){
|
||||
if(result == null){
|
||||
socket.disconnect();
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}catch(err){
|
||||
//Flip a table if something fucks up
|
||||
return loggerUtils.socketCriticalExceptionHandler(socket, err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue