Lint
parent
803858575f
commit
f064f98fd4
|
|
@ -36,7 +36,7 @@ class Lobby extends EventEmitter
|
|||
checkEmpty()
|
||||
{
|
||||
logger.info('checkEmpty()');
|
||||
|
||||
|
||||
return Object.keys(this._peers).length === 0;
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class Lobby extends EventEmitter
|
|||
logger.debug(
|
||||
'Peer "request" event [method:"%s", peer:"%s"]',
|
||||
request.method, peer.id);
|
||||
|
||||
|
||||
if (this._closed)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ module.exports = async function(rooms, peers, config)
|
|||
for (const [ producerId, producer ] of transport._producers)
|
||||
{
|
||||
logger.debug(`visiting producer ${producerId}`);
|
||||
const { roomId, peerId, displayName, userAgent, kind, codec } =
|
||||
const { roomId, peerId, displayName, userAgent, kind, codec } =
|
||||
commonLabels(producer, (peer) => peer._producers.has(producerId));
|
||||
const a = await producer.getStats();
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ module.exports = async function(rooms, peers, config)
|
|||
for (const [ consumerId, consumer ] of transport._consumers)
|
||||
{
|
||||
logger.debug(`visiting consumer ${consumerId}`);
|
||||
const { roomId, peerId, displayName, userAgent, kind, codec } =
|
||||
const { roomId, peerId, displayName, userAgent, kind, codec } =
|
||||
commonLabels(consumer, (peer) => peer._consumers.has(consumerId));
|
||||
const a = await consumer.getStats();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,10 +156,10 @@ async function run()
|
|||
// Run WebSocketServer.
|
||||
await runWebSocketServer();
|
||||
|
||||
const errorHandler = (err, req, res, next) =>
|
||||
const errorHandler = (err, req, res) =>
|
||||
{
|
||||
const trackingId = uuidv4();
|
||||
|
||||
|
||||
res.status(500).send(
|
||||
`<h1>Internal Server Error</h1>
|
||||
<p>If you report this error, please also report this
|
||||
|
|
@ -168,7 +168,7 @@ async function run()
|
|||
<b>${trackingId}</b></p>`
|
||||
);
|
||||
logger.error(
|
||||
'Express error handler dump with tracking ID: %s, error dump: %o',
|
||||
'Express error handler dump with tracking ID: %s, error dump: %o',
|
||||
trackingId, err);
|
||||
};
|
||||
|
||||
|
|
@ -375,18 +375,18 @@ async function setupAuth()
|
|||
const state = JSON.parse(base64.decode(req.query.state));
|
||||
|
||||
const { peerId, roomId } = state;
|
||||
|
||||
|
||||
req.session.peerId = peerId;
|
||||
req.session.roomId = roomId;
|
||||
|
||||
|
||||
let peer = peers.get(peerId);
|
||||
|
||||
|
||||
if (!peer) // User has no socket session yet, make temporary
|
||||
peer = new Peer({ id: peerId, roomId });
|
||||
|
||||
|
||||
if (peer.roomId !== roomId) // The peer is mischievous
|
||||
throw new Error('peer authenticated with wrong room');
|
||||
|
||||
|
||||
if (typeof config.userMapping === 'function')
|
||||
{
|
||||
await config.userMapping({
|
||||
|
|
@ -395,9 +395,9 @@ async function setupAuth()
|
|||
userinfo : req.user._userinfo
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
peer.authenticated = true;
|
||||
|
||||
|
||||
res.send(loginHelper({
|
||||
displayName : peer.displayName,
|
||||
picture : peer.picture
|
||||
|
|
@ -572,13 +572,13 @@ async function runWebSocketServer()
|
|||
email,
|
||||
_userinfo
|
||||
} = socket.handshake.session.passport.user;
|
||||
|
||||
|
||||
peer.authId = id;
|
||||
peer.displayName = displayName;
|
||||
peer.picture = picture;
|
||||
peer.email = email;
|
||||
peer.authenticated = true;
|
||||
|
||||
|
||||
if (typeof config.userMapping === 'function')
|
||||
{
|
||||
await config.userMapping({ peer, roomId, userinfo: _userinfo });
|
||||
|
|
|
|||
Loading…
Reference in New Issue