Added config for requiring guests to sign in.

This commit is contained in:
Håvar Aambø Fosstveit
2019-10-24 11:01:54 +02:00
parent 7e292b29c1
commit 5adb08e184
2 changed files with 24 additions and 8 deletions
+18 -8
View File
@@ -244,18 +244,28 @@ class Room extends EventEmitter
delete this._peers[peerId];
}
else if (this._locked) // Don't allow connections to a locked room
this._parkPeer({ peerId, consume, socket })
else if (config.requireSignInToAccess) // Only allow signed in users directly into room
{
this._lobby.parkPeer({ peerId, consume, socket });
const { passport } = socket.handshake.session;
Object.values(this._peers).forEach((peer) =>
{
this._notification(peer.socket, 'parkedPeer', { peerId });
});
return;
if (passport && passport.user)
this._peerJoining({ peerId, consume, socket });
else
this._parkPeer({ peerId, consume, socket })
}
else
this._peerJoining({ peerId, consume, socket });
}
this._peerJoining({ peerId, consume, socket });
_parkPeer({ peerId, consume, socket })
{
this._lobby.parkPeer({ peerId, consume, socket });
Object.values(this._peers).forEach((peer) =>
{
this._notification(peer.socket, 'parkedPeer', { peerId });
});
}
_peerJoining({ peerId, consume, socket })