Added config for requiring guests to sign in.

master
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

View File

@ -33,6 +33,12 @@ module.exports =
// Any http request is redirected to https.
// Listening port for http server.
listeningRedirectPort : 80,
// If this is set to true, only signed-in users will be able
// to join a room directly. Non-signed-in users (guests) will
// always be put in the lobby regardless of room lock status.
// If false, there is no difference between guests and signed-in
// users when joining.
requireSignInToAccess : true,
// Mediasoup settings
mediasoup :
{

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 })