Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
[RN] Load config.js with ?room=
Lyubo Marinovec9c05e40190
diff --git a/react/features/app/actions.js b/react/features/app/actions.jsindex d70d6d6f69..5316d05ada 100644--- a/react/features/app/actions.js+++ b/react/features/app/actions.js@@ -39,22 +39,11 @@ export function appNavigate(uri: ?string) {function _appNavigateToMandatoryLocation(dispatch: Dispatch<*>, getState: Function,newLocation: Object) {- const oldLocationURL = getState()['features/base/connection'].locationURL;- const oldHost = oldLocationURL ? oldLocationURL.host : undefined;- const newHost = newLocation.host;-- if (oldHost === newHost) {- dispatchSetLocationURL()- .then(dispatchSetRoom);- } else {- // If the host has changed, we need to load the config of the new host- // and set it, and only after that we can navigate to a different route.- _loadConfig(newLocation)- .then(- config => configLoaded(/* err */ undefined, config),- err => configLoaded(err, /* config */ undefined))- .then(dispatchSetRoom);- }+ _loadConfig(newLocation)+ .then(+ config => configLoaded(/* err */ undefined, config),+ err => configLoaded(err, /* config */ undefined))+ .then(() => dispatch(setRoom(newLocation.room)));/*** Notifies that an attempt to load a config(uration) has completed. Due to@@ -83,27 +72,9 @@ function _appNavigateToMandatoryLocation(}return (- dispatchSetLocationURL()+ dispatch(setLocationURL(new URL(newLocation.toString()))).then(() => dispatch(setConfig(config))));}-- /**- * Dispatches {@link setLocationURL} in the redux store.- *- * @returns {void}- */- function dispatchSetLocationURL() {- return dispatch(setLocationURL(new URL(newLocation.toString())));- }-- /**- * Dispatches {@link _setRoomAndNavigate} in the redux store.- *- * @returns {void}- */- function dispatchSetRoom() {- return dispatch(setRoom(newLocation.room));- }}/**@@ -196,8 +167,10 @@ export function appWillUnmount(app) {* @private* @returns {Promise<Object>}*/-function _loadConfig(location: Object) {- let protocol = location.protocol.toLowerCase();+function _loadConfig({ contextRoot, host, protocol, room }) {+ /* eslint-disable no-param-reassign */++ protocol = protocol.toLowerCase();// The React Native app supports an app-specific scheme which is sure to not// be supported by fetch (or whatever loadConfig utilizes).@@ -205,7 +178,12 @@ function _loadConfig(location: Object) {// TDOO userinfo- return (- loadConfig(- `${protocol}//${location.host}${location.contextRoot || '/'}`));+ let url = `${protocol}//${host}${contextRoot || '/'}config.js`;++ // XXX In order to support multiple shards, tell the room to the deployment.+ room && (url += `?room=${room.toLowerCase()}`);++ /* eslint-enable no-param-reassign */++ return loadConfig(url);}diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.jsindex 530778e738..efaf0c45b8 100644--- a/react/features/base/lib-jitsi-meet/functions.js+++ b/react/features/base/lib-jitsi-meet/functions.js@@ -54,16 +54,15 @@ export function isFatalJitsiConnectionError(error: string) {/*** Loads config.js from a specific remote server.*- * @param {string} host - Host where config.js is hosted.- * @param {string} path='config.js' - Relative pah to config.js file.+ * @param {string} url - The URL to load.* @returns {Promise<Object>}*/-export function loadConfig(host: string, path: string = 'config.js') {+export function loadConfig(url: string) {let promise;if (typeof APP === 'undefined') {promise- = loadScript(new URL(path, host).toString())+ = loadScript(url).then(() => {const { config } = window;@@ -77,7 +76,7 @@ export function loadConfig(host: string, path: string = 'config.js') {return config;}).catch(err => {- console.error(`Failed to load ${path} from ${host}`, err);+ console.error(`Failed to load config from ${url}`, err);throw err;});