@ -179,7 +179,7 @@ export function obtainConfig(
* @ returns { void }
* /
export function overrideConfigJSON (
config : Object , interfaceConfig : Object , loggingConfig : Object ,
config : ? Object , interfaceConfig : ? Object , loggingConfig : ? Object ,
json : Object ) {
for ( const configName of Object . keys ( json ) ) {
let configObj ;
@ -212,6 +212,8 @@ export function overrideConfigJSON(
}
}
/* eslint-enable max-params, no-shadow */
/ * *
* Whitelist only config . js , skips this for others configs
* ( interfaceConfig , loggingConfig ) .
@ -220,9 +222,9 @@ export function overrideConfigJSON(
* @ param { string } configName - The config name , one of config ,
* interfaceConfig , loggingConfig .
* @ param { Object } configJSON - The object with keys and values to override .
* @ private
* @ returns { Object } - The result object only with the keys
* that are whitelisted .
* @ private
* /
function _getWhitelistedJSON ( configName , configJSON ) {
if ( configName !== 'config' ) {
@ -232,40 +234,48 @@ function _getWhitelistedJSON(configName, configJSON) {
return _ . pick ( configJSON , WHITELISTED _KEYS ) ;
}
/* eslint-enable max-params, no-shadow */
/* eslint-disable max-params */
/ * *
* Converts 'URL_PARAMS' to JSON object .
* We have :
* {
* "config.disableAudioLevels" : false ,
* "config.channelLastN" : - 1 ,
* "interfaceConfig.APP_NAME" : "Jitsi Meet"
* } .
* We want to have :
* {
* "config" : {
* "disableAudioLevels" : false ,
* "channelLastN" : - 1
* } ,
* interfaceConfig : {
* "APP_NAME" : "Jitsi Meet"
* }
* } .
* Inspects the hash part of the location URI and overrides values specified
* there in the corresponding config objects given as the arguments . The syntax
* is : { @ code https : //server.com/room#config.debug=true
* & interfaceConfig . showButton = false & loggingConfig . something = 1 } .
*
* In the hash part each parameter will be parsed to JSON and then the root
* object will be matched with the corresponding config object given as the
* argument to this function .
*
* @ param { Object } config - This is the general config .
* @ param { Object } interfaceConfig - This is the interface config .
* @ param { Object } loggingConfig - The logging config .
* @ param { URI } location - The new location to which the app is navigating to .
* @ returns { void }
* /
export function setConfigFromURLParams ( ) {
const params = parseURLParams ( window . location ) ;
const { config , interfaceConfig , loggingConfig } = window ;
export function setConfigFromURLParams (
config : ? Object ,
interfaceConfig : ? Object ,
loggingConfig : ? Object ,
location : Object ) {
const params = parseURLParams ( location ) ;
const json = { } ;
// TODO We're still in the middle ground between old Web with config,
// interfaceConfig, and loggingConfig used via global variables and new Web
// and mobile reading the respective values from the redux store. On React
// Native there's no interfaceConfig at all yet and loggingConfig is not
// loaded but there's a default value in the redux store.
// At this point we have:
// params = {
// "config.disableAudioLevels": false,
// "config.channelLastN": -1,
// "interfaceConfig.APP_NAME": "Jitsi Meet"
// }
// We want to have:
// json = {
// config: {
// "disableAudioLevels": false,
// "channelLastN": -1
// },
// interfaceConfig: {
// "APP_NAME": "Jitsi Meet"
// }
// }
config && ( json . config = { } ) ;
interfaceConfig && ( json . interfaceConfig = { } ) ;
loggingConfig && ( json . loggingConfig = { } ) ;
@ -284,3 +294,5 @@ export function setConfigFromURLParams() {
overrideConfigJSON ( config , interfaceConfig , loggingConfig , json ) ;
}
/* eslint-enable max-params */