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
fix: Always normalizes bosh config.
damencho1466d7d149c8
diff --git a/config.js b/config.jsindex db811abe6a..9dd7e04cdd 100644--- a/config.js+++ b/config.js@@ -46,7 +46,7 @@ var config = {},// BOSH URL. FIXME: use XEP-0156 to discover it.- bosh: '//jitsi-meet.example.com/' + subdir + 'http-bind',+ bosh: 'https://jitsi-meet.example.com/' + subdir + 'http-bind',// Websocket URL// websocket: 'wss://jitsi-meet.example.com/' + subdir + 'xmpp-websocket',diff --git a/react/features/base/config/actions.ts b/react/features/base/config/actions.tsindex ea3e3671ba..448d1f0dc9 100644--- a/react/features/base/config/actions.ts+++ b/react/features/base/config/actions.ts@@ -98,7 +98,7 @@ export function overwriteConfig(config: Object) {* base/config.* @returns {Function}*/-export function setConfig(config: Object = {}) {+export function setConfig(config: IConfig = {}) {return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {const { locationURL } = getState()['features/base/connection'];@@ -119,6 +119,26 @@ export function setConfig(config: Object = {}) {window.interfaceConfig,locationURL);+ let { bosh } = config;++ if (bosh) {+ // Normalize the BOSH URL.+ if (bosh.startsWith('//')) {+ // By default our config.js doesn't include the protocol.+ bosh = `${locationURL?.protocol}${bosh}`;+ } else if (bosh.startsWith('/')) {+ // Handle relative URLs, which won't work on mobile.+ const {+ protocol,+ host,+ contextRoot+ } = parseURIString(locationURL?.href);++ bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;+ }+ config.bosh = bosh;+ }+dispatch({type: SET_CONFIG,configdiff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.tsindex f58ae8101f..080181138d 100644--- a/react/features/base/connection/actions.any.ts+++ b/react/features/base/connection/actions.any.ts@@ -3,8 +3,7 @@ import _ from 'lodash';import { IReduxState } from '../../app/types';import {appendURLParam,- getBackendSafeRoomName,- parseURIString+ getBackendSafeRoomName} from '../util/uri';import {@@ -145,7 +144,8 @@ export function constructOptions(state: IReduxState) {// redux store.const options = _.cloneDeep(state['features/base/config']);- let { bosh, websocket } = options;+ const { bosh } = options;+ let { websocket } = options;// TESTING: Only enable WebSocket for some percentage of users.if (websocket && navigator.product === 'ReactNative') {@@ -154,25 +154,6 @@ export function constructOptions(state: IReduxState) {}}- // Normalize the BOSH URL.- if (bosh && !websocket) {- const { locationURL } = state['features/base/connection'];-- if (bosh.startsWith('//')) {- // By default our config.js doesn't include the protocol.- bosh = `${locationURL?.protocol}${bosh}`;- } else if (bosh.startsWith('/')) {- // Handle relative URLs, which won't work on mobile.- const {- protocol,- host,- contextRoot- } = parseURIString(locationURL?.href);-- bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;- }- }-// WebSocket is preferred over BOSH.const serviceUrl = websocket || bosh;