diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js
index 7c586ef..99bf103 100644
--- a/app/src/RoomClient.js
+++ b/app/src/RoomClient.js
@@ -610,61 +610,44 @@ export default class RoomClient
const {
chatHistory,
fileHistory,
- lastN,
+ lastNHistory,
locked,
lobbyPeers,
accessCode
} = await this.sendRequest('serverHistory');
- if (chatHistory.length > 0)
- {
- logger.debug('Got chat history');
- store.dispatch(
- stateActions.addChatHistory(chatHistory));
- }
+ (chatHistory.length > 0) && store.dispatch(
+ stateActions.addChatHistory(chatHistory));
- if (fileHistory.length > 0)
- {
- logger.debug('Got files history');
+ (fileHistory.length > 0) && store.dispatch(
+ stateActions.addFileHistory(fileHistory));
- store.dispatch(stateActions.addFileHistory(fileHistory));
- }
-
- if (lastN.length > 0)
+ if (lastNHistory.length > 0)
{
- logger.debug('Got lastN');
+ logger.debug('Got lastNHistory');
// Remove our self from list
- const index = lastN.indexOf(this._peerId);
+ const index = lastNHistory.indexOf(this._peerId);
- lastN.splice(index, 1);
+ lastNHistory.splice(index, 1);
- this._spotlights.addSpeakerList(lastN);
+ this._spotlights.addSpeakerList(lastNHistory);
}
locked ?
store.dispatch(stateActions.setRoomLocked()) :
store.dispatch(stateActions.setRoomUnLocked());
- if (lobbyPeers.length > 0)
+ (lobbyPeers.length > 0) && lobbyPeers.forEach((peer) =>
{
- logger.debug('Got lobby peers');
+ store.dispatch(
+ stateActions.addLobbyPeer(peer.peerId));
+ store.dispatch(
+ stateActions.setLobbyPeerDisplayName(peer.displayName));
+ });
- lobbyPeers.forEach((peer) =>
- {
- store.dispatch(
- stateActions.addLobbyPeer(peer.peerId));
- store.dispatch(
- stateActions.setLobbyPeerDisplayName(peer.displayName));
- });
- }
-
- if (accessCode != null)
- {
- logger.debug('Got accessCode');
-
- store.dispatch(stateActions.setAccessCode(accessCode))
- }
+ (accessCode != null) && store.dispatch(
+ stateActions.setAccessCode(accessCode));
}
catch (error)
{
diff --git a/app/src/components/JoinDialog.js b/app/src/components/JoinDialog.js
index 1864dbc..e27d78e 100644
--- a/app/src/components/JoinDialog.js
+++ b/app/src/components/JoinDialog.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState } from 'react';
import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
import { withRoomContext } from '../RoomContext';
@@ -58,6 +58,28 @@ const JoinDialog = ({
classes
}) =>
{
+ const [ localDisplayName, setLocalDisplayName ] = useState(displayName);
+
+ const handleKeyDown = (event) =>
+ {
+ const { key } = event;
+
+ switch (key)
+ {
+ case 'Enter':
+ case 'Escape':
+ {
+ if (localDisplayName !== '') // Don't allow empty displayName
+ changeDisplayName(localDisplayName);
+ else
+ setLocalDisplayName(displayName);
+ break;
+ }
+ default:
+ break;
+ }
+ };
+
return (
}
-
+
+ Welcome
+
+
You are about to join a meeting.
- Set your name that others will see,
- and chose how you want to join?
+ Set the name that others will see,
+ and choose how you want to join?
{
const { value } = event.target;
- changeDisplayName(value);
+ setLocalDisplayName(value);
+ }}
+ onKeyDown={handleKeyDown}
+ onBlur={() =>
+ {
+ if (localDisplayName !== displayName)
+ changeDisplayName(localDisplayName);
}}
margin='normal'
/>
@@ -94,6 +125,17 @@ const JoinDialog = ({
roomClient.join({ joinVideo: false });
}}
variant='contained'
+ color='secondary'
+ >
+ Sign in
+
+
@@ -103,6 +145,7 @@ const JoinDialog = ({
roomClient.join({ joinVideo: true });
}}
variant='contained'
+ color='secondary'
>
Audio and Video
diff --git a/app/src/components/PeerAudio/PeerAudio.js b/app/src/components/PeerAudio/PeerAudio.js
index 2e9c195..38d7faf 100644
--- a/app/src/components/PeerAudio/PeerAudio.js
+++ b/app/src/components/PeerAudio/PeerAudio.js
@@ -29,7 +29,8 @@ export default class PeerAudio extends React.PureComponent
this._setTrack(audioTrack);
}
- componentWillReceiveProps(nextProps)
+ // eslint-disable-next-line camelcase
+ UNSAFE_componentWillReceiveProps(nextProps)
{
const { audioTrack } = nextProps;
diff --git a/app/src/components/VideoContainers/VideoView.js b/app/src/components/VideoContainers/VideoView.js
index 7947219..b90cc81 100644
--- a/app/src/components/VideoContainers/VideoView.js
+++ b/app/src/components/VideoContainers/VideoView.js
@@ -221,7 +221,7 @@ class VideoView extends React.PureComponent
ref='video'
className={classnames(classes.video, {
hidden : !videoVisible,
- 'isMe' : isMe && !isScreen,
+ 'isMe' : isMe && !isScreen,
loading : videoProfile === 'none',
contain : videoContain
})}
@@ -247,7 +247,8 @@ class VideoView extends React.PureComponent
clearInterval(this._videoResolutionTimer);
}
- componentWillReceiveProps(nextProps)
+ // eslint-disable-next-line camelcase
+ UNSAFE_componentWillReceiveProps(nextProps)
{
const { videoTrack } = nextProps;
diff --git a/server/.eslintrc.js b/server/.eslintrc.js
deleted file mode 100644
index bcdd959..0000000
--- a/server/.eslintrc.js
+++ /dev/null
@@ -1,168 +0,0 @@
-module.exports =
-{
- env:
- {
- browser: true,
- es6: true,
- node: true
- },
- extends:
- [
- 'eslint:recommended'
- ],
- settings: {},
- parserOptions:
- {
- ecmaVersion: 6,
- sourceType: 'module',
- ecmaFeatures:
- {
- impliedStrict: true
- }
- },
- rules:
- {
- 'array-bracket-spacing': [ 2, 'always',
- {
- objectsInArrays: true,
- arraysInArrays: true
- }],
- 'arrow-parens': [ 2, 'always' ],
- 'arrow-spacing': 2,
- 'block-spacing': [ 2, 'always' ],
- 'brace-style': [ 2, 'allman', { allowSingleLine: true } ],
- 'camelcase': 2,
- 'comma-dangle': 2,
- 'comma-spacing': [ 2, { before: false, after: true } ],
- 'comma-style': 2,
- 'computed-property-spacing': 2,
- 'constructor-super': 2,
- 'func-call-spacing': 2,
- 'generator-star-spacing': 2,
- 'guard-for-in': 2,
- 'indent': [ 2, 'tab', { 'SwitchCase': 1 } ],
- 'key-spacing': [ 2,
- {
- singleLine:
- {
- beforeColon: false,
- afterColon: true
- },
- multiLine:
- {
- beforeColon: true,
- afterColon: true,
- align: 'colon'
- }
- }],
- 'keyword-spacing': 2,
- 'linebreak-style': [ 2, 'unix' ],
- 'lines-around-comment': [ 2,
- {
- allowBlockStart: true,
- allowObjectStart: true,
- beforeBlockComment: true,
- beforeLineComment: false
- }],
- 'max-len': [ 2, 90,
- {
- tabWidth: 2,
- comments: 110,
- ignoreUrls: true,
- ignoreStrings: true,
- ignoreTemplateLiterals: true,
- ignoreRegExpLiterals: true
- }],
- 'newline-after-var': 2,
- 'newline-before-return': 2,
- 'newline-per-chained-call': 2,
- 'no-alert': 2,
- 'no-caller': 2,
- 'no-case-declarations': 2,
- 'no-catch-shadow': 2,
- 'no-class-assign': 2,
- 'no-confusing-arrow': 2,
- 'no-console': 2,
- 'no-const-assign': 2,
- 'no-debugger': 2,
- 'no-dupe-args': 2,
- 'no-dupe-keys': 2,
- 'no-duplicate-case': 2,
- 'no-div-regex': 2,
- 'no-empty': [ 2, { allowEmptyCatch: true } ],
- 'no-empty-pattern': 2,
- 'no-else-return': 0,
- 'no-eval': 2,
- 'no-extend-native': 2,
- 'no-ex-assign': 2,
- 'no-extra-bind': 2,
- 'no-extra-boolean-cast': 2,
- 'no-extra-label': 2,
- 'no-extra-semi': 2,
- 'no-fallthrough': 2,
- 'no-func-assign': 2,
- 'no-global-assign': 2,
- 'no-implicit-coercion': 2,
- 'no-implicit-globals': 2,
- 'no-inner-declarations': 2,
- 'no-invalid-regexp': 2,
- 'no-invalid-this': 2,
- 'no-irregular-whitespace': 2,
- 'no-lonely-if': 2,
- 'no-mixed-operators': 2,
- 'no-mixed-spaces-and-tabs': 2,
- 'no-multi-spaces': 2,
- 'no-multi-str': 2,
- 'no-multiple-empty-lines': [ 2, { max: 1, maxEOF: 0, maxBOF: 0 } ],
- 'no-native-reassign': 2,
- 'no-negated-in-lhs': 2,
- 'no-new': 2,
- 'no-new-func': 2,
- 'no-new-wrappers': 2,
- 'no-obj-calls': 2,
- 'no-proto': 2,
- 'no-prototype-builtins': 0,
- 'no-redeclare': 2,
- 'no-regex-spaces': 2,
- 'no-restricted-imports': 2,
- 'no-return-assign': 2,
- 'no-self-assign': 2,
- 'no-self-compare': 2,
- 'no-sequences': 2,
- 'no-shadow': 2,
- 'no-shadow-restricted-names': 2,
- 'no-spaced-func': 2,
- 'no-sparse-arrays': 2,
- 'no-this-before-super': 2,
- 'no-throw-literal': 2,
- 'no-undef': 2,
- 'no-unexpected-multiline': 2,
- 'no-unmodified-loop-condition': 2,
- 'no-unreachable': 2,
- 'no-unused-vars': [ 1, { vars: 'all', args: 'after-used' }],
- 'no-use-before-define': [ 2, { functions: false } ],
- 'no-useless-call': 2,
- 'no-useless-computed-key': 2,
- 'no-useless-concat': 2,
- 'no-useless-rename': 2,
- 'no-var': 2,
- 'no-whitespace-before-property': 2,
- 'object-curly-newline': 0,
- 'object-curly-spacing': [ 2, 'always' ],
- 'object-property-newline': [ 2, { allowMultiplePropertiesPerLine: true } ],
- 'prefer-const': 2,
- 'prefer-rest-params': 2,
- 'prefer-spread': 2,
- 'prefer-template': 2,
- 'quotes': [ 2, 'single', { avoidEscape: true } ],
- 'semi': [ 2, 'always' ],
- 'semi-spacing': 2,
- 'space-before-blocks': 2,
- 'space-before-function-paren': [ 2, 'never' ],
- 'space-in-parens': [ 2, 'never' ],
- 'spaced-comment': [ 2, 'always' ],
- 'strict': 0,
- 'valid-typeof': 2,
- 'yoda': 2
- }
-};
diff --git a/server/.eslintrc.json b/server/.eslintrc.json
new file mode 100644
index 0000000..d98852a
--- /dev/null
+++ b/server/.eslintrc.json
@@ -0,0 +1,171 @@
+{
+ "env":
+ {
+ "es6": true,
+ "node": true
+ },
+ "extends":
+ [
+ "eslint:recommended"
+ ],
+ "settings": {},
+ "parserOptions":
+ {
+ "ecmaVersion": 2018,
+ "sourceType": "module",
+ "ecmaFeatures":
+ {
+ "impliedStrict": true
+ }
+ },
+ "rules":
+ {
+ "array-bracket-spacing": [ 2, "always",
+ {
+ "objectsInArrays": true,
+ "arraysInArrays": true
+ }],
+ "arrow-parens": [ 2, "always" ],
+ "arrow-spacing": 2,
+ "block-spacing": [ 2, "always" ],
+ "brace-style": [ 2, "allman", { "allowSingleLine": true } ],
+ "camelcase": 2,
+ "comma-dangle": 2,
+ "comma-spacing": [ 2, { "before": false, "after": true } ],
+ "comma-style": 2,
+ "computed-property-spacing": 2,
+ "constructor-super": 2,
+ "func-call-spacing": 2,
+ "generator-star-spacing": 2,
+ "guard-for-in": 2,
+ "indent": [ 2, "tab", { "SwitchCase": 1 } ],
+ "key-spacing": [ 2,
+ {
+ "singleLine":
+ {
+ "beforeColon": false,
+ "afterColon": true
+ },
+ "multiLine":
+ {
+ "beforeColon": true,
+ "afterColon": true,
+ "align": "colon"
+ }
+ }],
+ "keyword-spacing": 2,
+ "linebreak-style": [ 2, "unix" ],
+ "lines-around-comment": [ 2,
+ {
+ "allowBlockStart": true,
+ "allowObjectStart": true,
+ "beforeBlockComment": true,
+ "beforeLineComment": false
+ }],
+ "max-len": [ 2, 90,
+ {
+ "tabWidth": 2,
+ "comments": 90,
+ "ignoreUrls": true,
+ "ignoreStrings": true,
+ "ignoreTemplateLiterals": true,
+ "ignoreRegExpLiterals": true
+ }],
+ "newline-after-var": 2,
+ "newline-before-return": 2,
+ "newline-per-chained-call": 2,
+ "no-alert": 2,
+ "no-caller": 2,
+ "no-case-declarations": 2,
+ "no-catch-shadow": 2,
+ "no-class-assign": 2,
+ "no-confusing-arrow": 2,
+ "no-console": 2,
+ "no-const-assign": 2,
+ "no-debugger": 2,
+ "no-dupe-args": 2,
+ "no-dupe-keys": 2,
+ "no-duplicate-case": 2,
+ "no-div-regex": 2,
+ "no-empty": [ 2, { "allowEmptyCatch": true } ],
+ "no-empty-pattern": 2,
+ "no-else-return": 0,
+ "no-eval": 2,
+ "no-extend-native": 2,
+ "no-ex-assign": 2,
+ "no-extra-bind": 2,
+ "no-extra-boolean-cast": 2,
+ "no-extra-label": 2,
+ "no-extra-semi": 2,
+ "no-fallthrough": 2,
+ "no-func-assign": 2,
+ "no-global-assign": 2,
+ "no-implicit-coercion": 2,
+ "no-implicit-globals": 2,
+ "no-inner-declarations": 2,
+ "no-invalid-regexp": 2,
+ "no-invalid-this": 2,
+ "no-irregular-whitespace": 2,
+ "no-lonely-if": 2,
+ "no-mixed-operators": 2,
+ "no-mixed-spaces-and-tabs": 2,
+ "no-multi-spaces": 2,
+ "no-multi-str": 2,
+ "no-multiple-empty-lines": [ 1, { "max": 1, "maxEOF": 0, "maxBOF": 0 } ],
+ "no-native-reassign": 2,
+ "no-negated-in-lhs": 2,
+ "no-new": 2,
+ "no-new-func": 2,
+ "no-new-wrappers": 2,
+ "no-obj-calls": 2,
+ "no-proto": 2,
+ "no-prototype-builtins": 0,
+ "no-redeclare": 2,
+ "no-regex-spaces": 2,
+ "no-restricted-imports": 2,
+ "no-return-assign": 2,
+ "no-self-assign": 2,
+ "no-self-compare": 2,
+ "no-sequences": 2,
+ "no-shadow": 2,
+ "no-shadow-restricted-names": 2,
+ "no-spaced-func": 2,
+ "no-sparse-arrays": 2,
+ "no-this-before-super": 2,
+ "no-throw-literal": 2,
+ "no-undef": 2,
+ "no-unexpected-multiline": 2,
+ "no-unmodified-loop-condition": 2,
+ "no-unreachable": 2,
+ "no-unused-vars": [ 1, { "vars": "all", "args": "after-used" }],
+ "no-use-before-define": [ 2, { "functions": false } ],
+ "no-useless-call": 2,
+ "no-useless-computed-key": 2,
+ "no-useless-concat": 2,
+ "no-useless-rename": 2,
+ "no-var": 2,
+ "no-whitespace-before-property": 2,
+ "object-curly-newline": 0,
+ "object-curly-spacing": [ 2, "always" ],
+ "object-property-newline": [ 2, { "allowMultiplePropertiesPerLine": true } ],
+ "prefer-const": 2,
+ "prefer-rest-params": 2,
+ "prefer-spread": 2,
+ "prefer-template": 2,
+ "quotes": [ 2, "single", { "avoidEscape": true } ],
+ "semi": [ 2, "always" ],
+ "semi-spacing": 2,
+ "space-before-blocks": 2,
+ "space-before-function-paren": [ 2,
+ {
+ "anonymous" : "never",
+ "named" : "never",
+ "asyncArrow" : "always"
+ }],
+ "space-in-parens": [ 2, "never" ],
+ "spaced-comment": [ 2, "always" ],
+ "strict": 2,
+ "valid-typeof": 2,
+ "yoda": 2
+ }
+}
\ No newline at end of file
diff --git a/server/gulpfile.js b/server/gulpfile.js
deleted file mode 100644
index fa03823..0000000
--- a/server/gulpfile.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Tasks:
- *
- * gulp lint
- * Checks source code
- *
- * gulp watch
- * Observes changes in the code
- *
- * gulp
- * Invokes both `lint` and `watch` tasks
- */
-
-const gulp = require('gulp');
-const plumber = require('gulp-plumber');
-const eslint = require('gulp-eslint');
-
-const LINTING_FILES =
-[
- 'gulpfile.js',
- 'server.js',
- 'config/config.example.js',
- 'lib/**/*.js'
-];
-
-gulp.task('lint', () =>
-{
-
- return gulp.src(LINTING_FILES)
- .pipe(plumber())
- .pipe(eslint())
- .pipe(eslint.format());
-});
-
-gulp.task('lint-fix', function()
-{
- return gulp.src(LINTING_FILES)
- .pipe(plumber())
- .pipe(eslint({ fix: true }))
- .pipe(eslint.format())
- .pipe(gulp.dest((file) => file.base));
-});
-
-gulp.task('default', gulp.series('lint'));
diff --git a/server/http-helpers.js b/server/http-helpers.js
deleted file mode 100644
index 9195b2f..0000000
--- a/server/http-helpers.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict';
-
-const headers = {
- 'access-control-allow-origin': '*',
- 'access-control-allow-methods': 'GET, POST, PUT, DELETE, OPTIONS',
- 'access-control-allow-headers': 'content-type, accept',
- 'access-control-max-age': 10,
- 'Content-Type': 'application/json'
-};
-
-exports.prepareResponse = (req, cb) =>
-{
- let data = '';
-
- req.on('data', (chunk) =>
- {
- data += chunk;
- });
-
- req.on('end', () =>
- {
- cb(data);
- });
-};
-
-exports.respond = (res, data, status) =>
-{
- status = status || 200;
- res.writeHead(status, headers);
- res.end(data);
-};
-
-exports.send404 = (res) =>
-{
- exports.respond(res, 'Not Found', 404);
-};
-
-exports.redirector = (res, loc, status) =>
-{
- status = status || 302;
- res.writeHead(status, { Location: loc });
- res.end();
-};
diff --git a/server/lib/Lobby.js b/server/lib/Lobby.js
index 62da0e5..e21be1d 100644
--- a/server/lib/Lobby.js
+++ b/server/lib/Lobby.js
@@ -1,5 +1,3 @@
-'use strict';
-
const EventEmitter = require('events').EventEmitter;
const Logger = require('./Logger');
@@ -38,7 +36,11 @@ class Lobby extends EventEmitter
{
logger.info('peerList()');
- return Object.values(this._peers).map((peer) => ({ peerId: peer.peerId, displayName: peer.displayName }));
+ return Object.values(this._peers).map((peer) =>
+ ({
+ peerId : peer.peerId,
+ displayName : peer.displayName
+ }));
}
hasPeer(peerId)
diff --git a/server/lib/Logger.js b/server/lib/Logger.js
index e1659dd..dc85948 100644
--- a/server/lib/Logger.js
+++ b/server/lib/Logger.js
@@ -1,5 +1,3 @@
-'use strict';
-
const debug = require('debug');
const APP_NAME = 'multiparty-meeting-server';
diff --git a/server/lib/Room.js b/server/lib/Room.js
index e702367..6335b56 100644
--- a/server/lib/Room.js
+++ b/server/lib/Room.js
@@ -1,5 +1,3 @@
-'use strict';
-
const EventEmitter = require('events').EventEmitter;
const Logger = require('./Logger');
const Lobby = require('./Lobby');
@@ -23,7 +21,7 @@ class Room extends EventEmitter
logger.info('create() [roomId:%s, forceH264:%s]', roomId);
// Router media codecs.
- let mediaCodecs = config.mediasoup.router.mediaCodecs;
+ const mediaCodecs = config.mediasoup.router.mediaCodecs;
// Create a mediasoup Router.
const mediasoupRouter = await mediasoupWorker.createRouter({ mediaCodecs });
@@ -58,18 +56,19 @@ class Room extends EventEmitter
// if true: accessCode is a possibility to open the room
this._joinByAccesCode = true;
- // access code to the room, applicable if ( _locked == true and _joinByAccessCode == true )
+ // access code to the room,
+ // applicable if ( _locked == true and _joinByAccessCode == true )
this._accessCode = '';
this._lobby = new Lobby();
- this._lobby.on('promotePeer', (peer) =>
+ this._lobby.on('promotePeer', (promotedPeer) =>
{
- logger.info('promotePeer() [peer:"%o"]', peer);
+ logger.info('promotePeer() [promotedPeer:"%o"]', promotedPeer);
- const { peerId } = peer;
+ const { peerId } = promotedPeer;
- this._peerJoining({ ...peer });
+ this._peerJoining({ ...promotedPeer });
Object.values(this._peers).forEach((peer) =>
{
@@ -77,9 +76,9 @@ class Room extends EventEmitter
});
});
- this._lobby.on('lobbyPeerDisplayNameChanged', (peer) =>
+ this._lobby.on('lobbyPeerDisplayNameChanged', (changedPeer) =>
{
- const { peerId, displayName } = peer;
+ const { peerId, displayName } = changedPeer;
Object.values(this._peers).forEach((peer) =>
{
@@ -87,11 +86,11 @@ class Room extends EventEmitter
});
});
- this._lobby.on('peerClosed', (peer) =>
+ this._lobby.on('peerClosed', (closedPeer) =>
{
- logger.info('peerClosed() [peer:"%o"]', peer);
+ logger.info('peerClosed() [closedPeer:"%o"]', closedPeer);
- const { peerId } = peer;
+ const { peerId } = closedPeer;
Object.values(this._peers).forEach((peer) =>
{
@@ -141,7 +140,7 @@ class Room extends EventEmitter
// Notify all Peers.
Object.values(this._peers).forEach((peer) =>
{
- this._notification(peer.socket, 'activeSpeaker', { peerId : null });
+ this._notification(peer.socket, 'activeSpeaker', { peerId: null });
});
});
@@ -223,7 +222,7 @@ class Room extends EventEmitter
{
socket.join(this._roomId);
- const peer = { id : peerId, socket : socket };
+ const peer = { id: peerId, socket: socket };
const index = this._lastN.indexOf(peerId);
@@ -243,13 +242,13 @@ class Room extends EventEmitter
return this._locked;
}
- peerAuthenticated(peerid)
+ peerAuthenticated(peerId)
{
logger.debug('peerAuthenticated() | [peerId:"%s"]', peerId);
if (!this._locked)
{
- if (!Boolean(this._peers[peerid]))
+ if (!this._peers[peerId])
{
this._lobby.promotePeer(peerId);
}
@@ -810,15 +809,16 @@ class Room extends EventEmitter
{
// Return to sender
const lobbyPeers = this._lobby.peerList();
+
cb(
null,
{
- chatHistory : this._chatHistory,
- fileHistory : this._fileHistory,
- lastN : this._lastN,
- locked : this._locked,
- lobbyPeers : lobbyPeers,
- accessCode : this._accessCode
+ chatHistory : this._chatHistory,
+ fileHistory : this._fileHistory,
+ lastNHistory : this._lastN,
+ locked : this._locked,
+ lobbyPeers : lobbyPeers,
+ accessCode : this._accessCode
}
);
@@ -867,7 +867,7 @@ class Room extends EventEmitter
peerId : peer.id,
accessCode : accessCode
}, true);
- //}
+ // }
// Return no error
cb();
@@ -883,7 +883,7 @@ class Room extends EventEmitter
// Spread to others
this._notification(peer.socket, 'setJoinByAccessCode', {
- peerId : peer.id,
+ peerId : peer.id,
joinByAccessCode : joinByAccessCode
}, true);
@@ -892,7 +892,6 @@ class Room extends EventEmitter
break;
}
-
case 'promotePeer':
{
@@ -1080,7 +1079,6 @@ class Room extends EventEmitter
kind : producer.kind,
producerId : producer.id,
id : consumer.id,
- kind : consumer.kind,
rtpParameters : consumer.rtpParameters,
type : consumer.type,
appData : producer.appData,
diff --git a/server/package.json b/server/package.json
index 76e6ab6..4a80107 100644
--- a/server/package.json
+++ b/server/package.json
@@ -1,29 +1,24 @@
{
- "name": "multiparty-meeting-server",
- "version": "3.0.0",
- "private": true,
- "description": "multiparty meeting server",
- "author": "Håvar Aambø Fosstveit ",
- "license": "MIT",
- "main": "lib/index.js",
- "dependencies": {
- "awaitqueue": "^1.0.0",
- "base-64": "^0.1.0",
- "colors": "^1.4.0",
- "compression": "^1.7.4",
- "debug": "^4.1.1",
- "express": "^4.17.1",
- "express-session": "^1.17.0",
- "express-socket.io-session": "^1.3.5",
- "mediasoup": "^3.0.12",
- "openid-client": "^3.7.3",
- "passport": "^0.4.0",
- "socket.io": "^2.3.0",
- "spdy": "^4.0.1"
- },
- "devDependencies": {
- "gulp": "^4.0.2",
- "gulp-eslint": "^6.0.0",
- "gulp-plumber": "^1.2.1"
- }
+ "name": "multiparty-meeting-server",
+ "version": "3.0.0",
+ "private": true,
+ "description": "multiparty meeting server",
+ "author": "Håvar Aambø Fosstveit ",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "dependencies": {
+ "awaitqueue": "^1.0.0",
+ "base-64": "^0.1.0",
+ "colors": "^1.4.0",
+ "compression": "^1.7.4",
+ "debug": "^4.1.1",
+ "express": "^4.17.1",
+ "express-session": "^1.17.0",
+ "express-socket.io-session": "^1.3.5",
+ "mediasoup": "^3.0.12",
+ "openid-client": "^3.7.3",
+ "passport": "^0.4.0",
+ "socket.io": "^2.3.0",
+ "spdy": "^4.0.1"
+ }
}
diff --git a/server/server.js b/server/server.js
index 4e42518..32d953d 100755
--- a/server/server.js
+++ b/server/server.js
@@ -1,7 +1,5 @@
#!/usr/bin/env node
-'use strict';
-
process.title = 'multiparty-meeting-server';
const config = require('./config/config');
@@ -14,7 +12,6 @@ const mediasoup = require('mediasoup');
const AwaitQueue = require('awaitqueue');
const Logger = require('./lib/Logger');
const Room = require('./lib/Room');
-const utils = require('./util');
const base64 = require('base-64');
// auth
const passport = require('passport');
@@ -26,7 +23,7 @@ const sharedSession = require('express-socket.io-session');
console.log('- process.env.DEBUG:', process.env.DEBUG);
console.log('- config.mediasoup.logLevel:', config.mediasoup.logLevel);
console.log('- config.mediasoup.logTags:', config.mediasoup.logTags);
-/* eslint-enable nopassportSocketIo-console */
+/* eslint-enable no-console */
const logger = new Logger();
@@ -57,11 +54,12 @@ const session = expressSession({
resave : true,
saveUninitialized : true,
cookie : { secure: true }
-})
+});
app.use(session);
let httpsServer;
+let io;
let oidcClient;
let oidcStrategy;
@@ -99,10 +97,10 @@ async function run()
// Run WebSocketServer.
await runWebSocketServer();
})
- .catch((err) =>
- {
- logger.error(err);
- });
+ .catch((err) =>
+ {
+ logger.error(err);
+ });
}
else
{
@@ -219,8 +217,7 @@ async function setupAuth(oidcIssuer)
state : base64.encode(JSON.stringify({
id : req.query.id,
roomId : req.query.roomId,
- peerId : req.query.peerId,
- code : utils.random(10)
+ peerId : req.query.peerId
}))
})(req, res, next);
});
@@ -265,14 +262,14 @@ async function setupAuth(oidcIssuer)
room.peerAuthenticated(state.peerId);
io.sockets.socket(state.id).emit('notification',
- {
- method: 'auth',
- data :
{
- displayName : displayName,
- picture : photo
- }
- });
+ method : 'auth',
+ data :
+ {
+ displayName : displayName,
+ picture : photo
+ }
+ });
res.send('');
}
@@ -325,11 +322,11 @@ async function runHttpsServer()
*/
async function runWebSocketServer()
{
- const io = require('socket.io')(httpsServer);
+ io = require('socket.io')(httpsServer);
io.use(
sharedSession(session, {
- autoSave: true
+ autoSave : true
})
);
@@ -356,14 +353,14 @@ async function runWebSocketServer()
room.handleConnection({ peerId, socket });
})
- .catch((error) =>
- {
- logger.error('room creation or room joining failed:%o', error);
+ .catch((error) =>
+ {
+ logger.error('room creation or room joining failed:%o', error);
- socket.disconnect(true);
+ socket.disconnect(true);
- return;
- });
+ return;
+ });
});
}
diff --git a/server/util.js b/server/util.js
deleted file mode 100644
index cfa4548..0000000
--- a/server/util.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-var crypto = require('crypto');
-
-exports.random = function (howMany, chars) {
- chars = chars
- || "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
- var rnd = crypto.randomBytes(howMany)
- , value = new Array(howMany)
- , len = len = Math.min(256, chars.length)
- , d = 256 / len
-
- for (var i = 0; i < howMany; i++) {
- value[i] = chars[Math.floor(rnd[i] / d)]
- };
-
- return value.join('');
-}