diff --git a/react/features/app/actions.js b/react/features/app/actions.js index 3c0082d19..aca96b65f 100644 --- a/react/features/app/actions.js +++ b/react/features/app/actions.js @@ -5,6 +5,7 @@ import type { Dispatch } from 'redux'; import { setRoom } from '../base/conference'; import { configWillLoad, + createFakeConfig, loadConfigError, restoreConfig, setConfig, @@ -101,9 +102,15 @@ export function appNavigate(uri: ?string) { config = restoreConfig(baseURL); if (!config) { - dispatch(loadConfigError(error, locationURL)); + if (room) { + dispatch(loadConfigError(error, locationURL)); - return; + return; + } + + // If there is no room (we are on the welcome page), don't fail, just create a fake one. + logger.warn('Failed to load config but there is no room, applying a fake one'); + config = createFakeConfig(baseURL); } } } diff --git a/react/features/base/config/functions.any.js b/react/features/base/config/functions.any.js index be2bf038a..7b7643a50 100644 --- a/react/features/base/config/functions.any.js +++ b/react/features/base/config/functions.any.js @@ -155,6 +155,29 @@ const WHITELISTED_KEYS = [ export { default as getRoomName } from './getRoomName'; export { parseURLParams }; +/** + * Create a "fake" configuration object for the given base URL. This is used in case the config + * couldn't be loaded in the welcome page, so at least we have something to try with. + * + * @param {string} baseURL - URL of the deployment for which we want the fake config. + * @returns {Object} + */ +export function createFakeConfig(baseURL: string) { + const url = new URL(baseURL); + + return { + hosts: { + domain: url.hostname, + muc: `conference.${url.hostname}` + }, + bosh: `${baseURL}http-bind`, + clientNode: 'https://jitsi.org/jitsi-meet', + p2p: { + enabled: true + } + }; +} + /** * Promise wrapper on obtain config method. When HttpConfigFetch will be moved * to React app it's better to use load config instead.