auto_join_3.3
Håvar Aambø Fosstveit 2020-05-19 14:26:19 +02:00
parent a0a23109a9
commit d9cce46505
3 changed files with 22 additions and 16 deletions

View File

@ -106,6 +106,12 @@
"no-invalid-regexp": 2, "no-invalid-regexp": 2,
"no-invalid-this": 2, "no-invalid-this": 2,
"no-irregular-whitespace": 2, "no-irregular-whitespace": 2,
"no-trailing-spaces": [
"error",
{
"ignoreComments": true
}
],
"no-lonely-if": 2, "no-lonely-if": 2,
"no-mixed-operators": 2, "no-mixed-operators": 2,
"no-mixed-spaces-and-tabs": 2, "no-mixed-spaces-and-tabs": 2,

View File

@ -83,9 +83,9 @@ class Peer extends EventEmitter
{ {
if (this.closed) if (this.closed)
return; return;
logger.debug('"disconnect" event [id:%s]', this.id); logger.debug('"disconnect" event [id:%s]', this.id);
this.close(); this.close();
}); });
} }
@ -208,7 +208,7 @@ class Peer extends EventEmitter
const oldDisplayName = this._displayName; const oldDisplayName = this._displayName;
this._displayName = displayName; this._displayName = displayName;
this.emit('displayNameChanged', { oldDisplayName }); this.emit('displayNameChanged', { oldDisplayName });
} }
} }
@ -225,7 +225,7 @@ class Peer extends EventEmitter
const oldPicture = this._picture; const oldPicture = this._picture;
this._picture = picture; this._picture = picture;
this.emit('pictureChanged', { oldPicture }); this.emit('pictureChanged', { oldPicture });
} }
} }

View File

@ -493,7 +493,7 @@ class Room extends EventEmitter
peer.socket.handshake.session.save(); peer.socket.handshake.session.save();
let turnServers; let turnServers;
if ('turnAPIURI' in config) if ('turnAPIURI' in config)
{ {
try try
@ -507,7 +507,7 @@ class Room extends EventEmitter
'ip' : peer.socket.request.connection.remoteAddress 'ip' : peer.socket.request.connection.remoteAddress
} }
}); });
turnServers = [ { turnServers = [ {
urls : data.uris, urls : data.uris,
username : data.username, username : data.username,
@ -518,7 +518,7 @@ class Room extends EventEmitter
{ {
if ('backupTurnServers' in config) if ('backupTurnServers' in config)
turnServers = config.backupTurnServers; turnServers = config.backupTurnServers;
logger.error('_peerJoining() | error on REST turn [error:"%o"]', error); logger.error('_peerJoining() | error on REST turn [error:"%o"]', error);
} }
} }
@ -526,7 +526,7 @@ class Room extends EventEmitter
{ {
turnServers = config.backupTurnServers; turnServers = config.backupTurnServers;
} }
this._notification(peer.socket, 'roomReady', { turnServers }); this._notification(peer.socket, 'roomReady', { turnServers });
} }
}) })
@ -779,7 +779,7 @@ class Room extends EventEmitter
// initiate mediasoup Transports and be ready when he later joins. // initiate mediasoup Transports and be ready when he later joins.
const { forceTcp, producing, consuming } = request.data; const { forceTcp, producing, consuming } = request.data;
const webRtcTransportOptions = const webRtcTransportOptions =
{ {
...config.mediasoup.webRtcTransport, ...config.mediasoup.webRtcTransport,
@ -1187,7 +1187,7 @@ class Room extends EventEmitter
throw new Error('peer not authorized'); throw new Error('peer not authorized');
const { chatMessage } = request.data; const { chatMessage } = request.data;
this._chatHistory.push(chatMessage); this._chatHistory.push(chatMessage);
// Spread to others // Spread to others
@ -1206,7 +1206,7 @@ class Room extends EventEmitter
{ {
if (!this._hasPermission(peer, MODERATE_CHAT)) if (!this._hasPermission(peer, MODERATE_CHAT))
throw new Error('peer not authorized'); throw new Error('peer not authorized');
this._chatHistory = []; this._chatHistory = [];
// Spread to others // Spread to others
@ -1259,7 +1259,7 @@ class Room extends EventEmitter
case 'setAccessCode': case 'setAccessCode':
{ {
const { accessCode } = request.data; const { accessCode } = request.data;
this._accessCode = accessCode; this._accessCode = accessCode;
// Spread to others // Spread to others
@ -1279,7 +1279,7 @@ class Room extends EventEmitter
case 'setJoinByAccessCode': case 'setJoinByAccessCode':
{ {
const { joinByAccessCode } = request.data; const { joinByAccessCode } = request.data;
this._joinByAccessCode = joinByAccessCode; this._joinByAccessCode = joinByAccessCode;
// Spread to others // Spread to others
@ -1328,7 +1328,7 @@ class Room extends EventEmitter
throw new Error('peer not authorized'); throw new Error('peer not authorized');
const { magnetUri } = request.data; const { magnetUri } = request.data;
this._fileHistory.push({ peerId: peer.id, magnetUri: magnetUri }); this._fileHistory.push({ peerId: peer.id, magnetUri: magnetUri });
// Spread to others // Spread to others
@ -1347,7 +1347,7 @@ class Room extends EventEmitter
{ {
if (!this._hasPermission(peer, MODERATE_FILES)) if (!this._hasPermission(peer, MODERATE_FILES))
throw new Error('peer not authorized'); throw new Error('peer not authorized');
this._fileHistory = []; this._fileHistory = [];
// Spread to others // Spread to others
@ -1907,7 +1907,7 @@ class Room extends EventEmitter
for (const routerId of this._mediasoupRouters.keys()) for (const routerId of this._mediasoupRouters.keys())
{ {
const routerLoad = const routerLoad =
Object.values(this._peers).filter((peer) => peer.routerId === routerId).length; Object.values(this._peers).filter((peer) => peer.routerId === routerId).length;
if (routerLoad < load) if (routerLoad < load)