Added config for requiring guests to sign in.
parent
7e292b29c1
commit
5adb08e184
|
|
@ -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 :
|
||||
{
|
||||
|
|
|
|||
|
|
@ -244,6 +244,21 @@ 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
|
||||
{
|
||||
const { passport } = socket.handshake.session;
|
||||
|
||||
if (passport && passport.user)
|
||||
this._peerJoining({ peerId, consume, socket });
|
||||
else
|
||||
this._parkPeer({ peerId, consume, socket })
|
||||
}
|
||||
else
|
||||
this._peerJoining({ peerId, consume, socket });
|
||||
}
|
||||
|
||||
_parkPeer({ peerId, consume, socket })
|
||||
{
|
||||
this._lobby.parkPeer({ peerId, consume, socket });
|
||||
|
||||
|
|
@ -251,11 +266,6 @@ class Room extends EventEmitter
|
|||
{
|
||||
this._notification(peer.socket, 'parkedPeer', { peerId });
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this._peerJoining({ peerId, consume, socket });
|
||||
}
|
||||
|
||||
_peerJoining({ peerId, consume, socket })
|
||||
|
|
|
|||
Loading…
Reference in New Issue