Allow serving other than root of site, fixes #249
parent
02b6c617c5
commit
2373bf44d8
|
|
@ -129,7 +129,8 @@ export default class RoomClient
|
||||||
produce,
|
produce,
|
||||||
forceTcp,
|
forceTcp,
|
||||||
displayName,
|
displayName,
|
||||||
muted
|
muted,
|
||||||
|
basePath
|
||||||
} = {})
|
} = {})
|
||||||
{
|
{
|
||||||
if (!peerId)
|
if (!peerId)
|
||||||
|
|
@ -152,6 +153,9 @@ export default class RoomClient
|
||||||
// Whether we force TCP
|
// Whether we force TCP
|
||||||
this._forceTcp = forceTcp;
|
this._forceTcp = forceTcp;
|
||||||
|
|
||||||
|
// URL basepath
|
||||||
|
this._basePath = basePath;
|
||||||
|
|
||||||
// Use displayName
|
// Use displayName
|
||||||
if (displayName)
|
if (displayName)
|
||||||
store.dispatch(settingsActions.setDisplayName(displayName));
|
store.dispatch(settingsActions.setDisplayName(displayName));
|
||||||
|
|
@ -1719,7 +1723,7 @@ export default class RoomClient
|
||||||
|
|
||||||
this._screenSharing = ScreenShare.create(this._device);
|
this._screenSharing = ScreenShare.create(this._device);
|
||||||
|
|
||||||
this._signalingSocket = io(this._signalingUrl);
|
this._signalingSocket = io(this._signalingUrl, { path: this._basePath });
|
||||||
|
|
||||||
this._spotlights = new Spotlights(this._maxSpotlights, this._signalingSocket);
|
this._spotlights = new Spotlights(this._maxSpotlights, this._signalingSocket);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,13 @@ function run()
|
||||||
const displayName = parameters.get('displayName');
|
const displayName = parameters.get('displayName');
|
||||||
const muted = parameters.get('muted') === 'true';
|
const muted = parameters.get('muted') === 'true';
|
||||||
|
|
||||||
|
const { pathname } = window.location;
|
||||||
|
|
||||||
|
let basePath = pathname.substring(0, pathname.lastIndexOf('/'));
|
||||||
|
|
||||||
|
if (!basePath)
|
||||||
|
basePath = '/';
|
||||||
|
|
||||||
// Get current device.
|
// Get current device.
|
||||||
const device = deviceInfo();
|
const device = deviceInfo();
|
||||||
|
|
||||||
|
|
@ -134,7 +141,8 @@ function run()
|
||||||
produce,
|
produce,
|
||||||
forceTcp,
|
forceTcp,
|
||||||
displayName,
|
displayName,
|
||||||
muted
|
muted,
|
||||||
|
basePath
|
||||||
});
|
});
|
||||||
|
|
||||||
global.CLIENT = roomClient;
|
global.CLIENT = roomClient;
|
||||||
|
|
@ -146,7 +154,7 @@ function run()
|
||||||
<PersistGate loading={<LoadingView />} persistor={persistor}>
|
<PersistGate loading={<LoadingView />} persistor={persistor}>
|
||||||
<RoomContext.Provider value={roomClient}>
|
<RoomContext.Provider value={roomClient}>
|
||||||
<SnackbarProvider>
|
<SnackbarProvider>
|
||||||
<Router>
|
<Router basename={basePath}>
|
||||||
<Suspense fallback={<LoadingView />}>
|
<Suspense fallback={<LoadingView />}>
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Route exact path='/' component={ChooseRoom} />
|
<Route exact path='/' component={ChooseRoom} />
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,7 @@ function isPathAlreadyTaken(url)
|
||||||
*/
|
*/
|
||||||
async function runWebSocketServer()
|
async function runWebSocketServer()
|
||||||
{
|
{
|
||||||
io = require('socket.io')(mainListener);
|
io = require('socket.io')(mainListener, { path: '/' });
|
||||||
|
|
||||||
io.use(
|
io.use(
|
||||||
sharedSession(session, {
|
sharedSession(session, {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue