Remove unused dependencies. Fix handling of missing roomId.
parent
21a1322415
commit
4b3219f614
|
|
@ -13,7 +13,6 @@
|
||||||
"domready": "^1.0.8",
|
"domready": "^1.0.8",
|
||||||
"file-saver": "^2.0.1",
|
"file-saver": "^2.0.1",
|
||||||
"hark": "^1.2.3",
|
"hark": "^1.2.3",
|
||||||
"js-cookie": "^2.2.0",
|
|
||||||
"marked": "^0.6.1",
|
"marked": "^0.6.1",
|
||||||
"mediasoup-client": "^3.0.6",
|
"mediasoup-client": "^3.0.6",
|
||||||
"notistack": "^0.5.1",
|
"notistack": "^0.5.1",
|
||||||
|
|
@ -22,20 +21,16 @@
|
||||||
"react": "^16.8.5",
|
"react": "^16.8.5",
|
||||||
"react-cookie-consent": "^2.2.2",
|
"react-cookie-consent": "^2.2.2",
|
||||||
"react-dom": "^16.8.5",
|
"react-dom": "^16.8.5",
|
||||||
"react-draggable": "^3.2.1",
|
|
||||||
"react-redux": "^6.0.1",
|
"react-redux": "^6.0.1",
|
||||||
"react-scripts": "2.1.8",
|
"react-scripts": "2.1.8",
|
||||||
"react-tooltip": "^3.10.0",
|
|
||||||
"redux": "^4.0.1",
|
"redux": "^4.0.1",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-persist": "^5.10.0",
|
"redux-persist": "^5.10.0",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"reselect": "^4.0.0",
|
"reselect": "^4.0.0",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
|
||||||
"riek": "^1.1.0",
|
"riek": "^1.1.0",
|
||||||
"socket.io-client": "^2.2.0",
|
"socket.io-client": "^2.2.0",
|
||||||
"source-map-explorer": "^1.8.0",
|
"source-map-explorer": "^1.8.0",
|
||||||
"url-parse": "^1.4.4",
|
|
||||||
"webtorrent": "^0.103.1"
|
"webtorrent": "^0.103.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import domready from 'domready';
|
import domready from 'domready';
|
||||||
import UrlParse from 'url-parse';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render } from 'react-dom';
|
import { render } from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
|
@ -45,41 +44,30 @@ function run()
|
||||||
logger.debug('run() [environment:%s]', process.env.NODE_ENV);
|
logger.debug('run() [environment:%s]', process.env.NODE_ENV);
|
||||||
|
|
||||||
const peerId = randomString({ length: 8 }).toLowerCase();
|
const peerId = randomString({ length: 8 }).toLowerCase();
|
||||||
const urlParser = new UrlParse(window.location.href, true);
|
const urlParser = new URL(window.location);
|
||||||
|
const parameters = urlParser.searchParams;
|
||||||
|
|
||||||
let roomId = (urlParser.pathname).substr(1)
|
let roomId = (urlParser.pathname).substr(1);
|
||||||
? (urlParser.pathname).substr(1).toLowerCase() : urlParser.query.roomId.toLowerCase();
|
|
||||||
const produce = urlParser.query.produce !== 'false';
|
|
||||||
const consume = urlParser.query.consume !== 'false';
|
|
||||||
const useSimulcast = urlParser.query.simulcast === 'true';
|
|
||||||
const forceTcp = urlParser.query.forceTcp === 'true';
|
|
||||||
|
|
||||||
if (!roomId)
|
if (!roomId)
|
||||||
|
roomId = parameters.get('roomId');
|
||||||
|
|
||||||
|
if (roomId)
|
||||||
|
roomId = roomId.toLowerCase();
|
||||||
|
else
|
||||||
{
|
{
|
||||||
roomId = randomString({ length: 8 }).toLowerCase();
|
roomId = randomString({ length: 8 }).toLowerCase();
|
||||||
|
|
||||||
urlParser.query.roomId = roomId;
|
parameters.set('roomId', roomId);
|
||||||
window.history.pushState('', '', urlParser.toString());
|
window.history.pushState('', '', urlParser.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the effective/shareable Room URL.
|
const produce = parameters.get('produce') !== 'false';
|
||||||
const roomUrlParser = new UrlParse(window.location.href, true);
|
const consume = parameters.get('consume') !== 'false';
|
||||||
|
const useSimulcast = parameters.get('simulcast') === 'true';
|
||||||
|
const forceTcp = parameters.get('forceTcp') === 'true';
|
||||||
|
|
||||||
for (const key of Object.keys(roomUrlParser.query))
|
const roomUrl = window.location.href.split('?')[0];
|
||||||
{
|
|
||||||
// Don't keep some custom params.
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
case 'roomId':
|
|
||||||
case 'simulcast':
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
delete roomUrlParser.query[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete roomUrlParser.hash;
|
|
||||||
|
|
||||||
const roomUrl = roomUrlParser.toString();
|
|
||||||
|
|
||||||
// Get current device.
|
// Get current device.
|
||||||
const device = deviceInfo();
|
const device = deviceInfo();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import omit from 'lodash/omit';
|
|
||||||
|
|
||||||
const peer = (state = {}, action) =>
|
const peer = (state = {}, action) =>
|
||||||
{
|
{
|
||||||
switch (action.type)
|
switch (action.type)
|
||||||
|
|
@ -58,7 +56,12 @@ const peers = (state = {}, action) =>
|
||||||
|
|
||||||
case 'REMOVE_PEER':
|
case 'REMOVE_PEER':
|
||||||
{
|
{
|
||||||
return omit(state, [ action.payload.peerId ]);
|
const { peerId } = action.payload;
|
||||||
|
const newState = { ...state };
|
||||||
|
|
||||||
|
delete newState[peerId];
|
||||||
|
|
||||||
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'SET_PEER_DISPLAY_NAME':
|
case 'SET_PEER_DISPLAY_NAME':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue