From 2a3c4cfb8226b5a4a6255b0193a928c54bd57af8 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Fri, 30 Jun 2017 13:37:11 -0500 Subject: [PATCH 1/3] ref: Adds deployment info variables to config.js, removes local.html --- config.js | 7 +++++++ local.html | 0 2 files changed, 7 insertions(+) delete mode 100644 local.html diff --git a/config.js b/config.js index 696da13a2..cdc23f6dd 100644 --- a/config.js +++ b/config.js @@ -106,5 +106,12 @@ var config = { // eslint-disable-line no-unused-vars // How long we're going to wait, before going back to P2P after // the 3rd participant has left the conference (to filter out page reload) //backToP2PDelay: 5 + }, + // Information about the jitsi-meet instance we are connecting to, including the + // user region as seen by the server. + deploymentInfo: { + //shard: "shard1", + //region: "europe", + //userRegion: "asia" } }; diff --git a/local.html b/local.html deleted file mode 100644 index e69de29bb..000000000 From b09613b9432c949609835c7a9449d8e8a22d208c Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 5 Jul 2017 16:07:16 -0500 Subject: [PATCH 2/3] ref: Uses config.deploymentInfo instead of window.jitsiDeploymentInfo. --- modules/analytics/analytics.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/modules/analytics/analytics.js b/modules/analytics/analytics.js index d42440a64..2a495052f 100644 --- a/modules/analytics/analytics.js +++ b/modules/analytics/analytics.js @@ -4,7 +4,7 @@ * Load the integration of a third-party analytics API such as Google * Analytics. Since we cannot guarantee the quality of the third-party service * (e.g. their server may take noticeably long time to respond), it is in our - * best interest (in the sense that the intergration of the analytics API is + * best interest (in the sense that the integration of the analytics API is * important to us but not enough to allow it to prevent people from joining * a conference) to download the API asynchronously. Additionally, Google * Analytics will download its implementation asynchronously anyway so it makes @@ -77,7 +77,7 @@ class Analytics { Promise.all(handlersPromises).then(values => { values.forEach(el => { if(el.type === "error") { - console.log("Fialed to load " + el.url); + console.log("Failed to load " + el.url); console.error(el.error); } }); @@ -122,15 +122,11 @@ class Analytics { if (group) { permanentProperties.group = group; } - /** - * optionally include local deployment information, - * window.jitsiDeploymentInfo defined outside of application - * to use, override contents in local.html - **/ - if (window.jitsiDeploymentInfo) { - for (var key in window.jitsiDeploymentInfo) { - permanentProperties[key] - = window.jitsiDeploymentInfo[key]; + // optionally include local deployment information based on + // the contents of window.config.deploymentInfo + if (config.deploymentInfo) { + for (var key in config.deploymentInfo) { + permanentProperties[key] = config.deploymentInfo[key]; } } From 4840db67caeffc4fe38326a5a38a8c89dbf9b06f Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 5 Jul 2017 16:31:50 -0500 Subject: [PATCH 3/3] fix: adds a hasOwnProperty check, uses "let". --- modules/analytics/analytics.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/analytics/analytics.js b/modules/analytics/analytics.js index 2a495052f..25007e410 100644 --- a/modules/analytics/analytics.js +++ b/modules/analytics/analytics.js @@ -125,8 +125,11 @@ class Analytics { // optionally include local deployment information based on // the contents of window.config.deploymentInfo if (config.deploymentInfo) { - for (var key in config.deploymentInfo) { - permanentProperties[key] = config.deploymentInfo[key]; + for (let key in config.deploymentInfo) { + if (config.deploymentInfo.hasOwnProperty(key)) { + permanentProperties[key] + = config.deploymentInfo[key]; + } } }