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] Cache configurations in localStorage
Saúl Ibarra Corretgé034518a6a084
diff --git a/react/features/app/actions.js b/react/features/app/actions.jsindex 962d21978f..adfea43d0a 100644--- a/react/features/app/actions.js+++ b/react/features/app/actions.js@@ -186,12 +186,49 @@ function _loadConfig({ contextRoot, host, protocol, room }) {// TDOO userinfo- let url = `${protocol}//${host}${contextRoot || '/'}config.js`;+ const rootUrl = `${protocol}//${host}${contextRoot || '/'}`;+ let url = `${rootUrl}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);+ const key = `config/${rootUrl}`;++ return (+ loadConfig(url)+ .then(config => {+ // Try to store the configuration in localStorage. If the+ // deployment specified the 'getroom' option as a function, for+ // example, we cannot store it, so don't.+ try {+ window.localStorage.setItem(key, JSON.stringify(config));+ } catch (e) {++ // Ignore the error, we won't cache this config.+ }++ return config;+ })+ .catch(error => {+ // We failed to load the requested config, try to use the last+ // one which was fetched for that deployment. It may not match+ // the shard, but it's probably better than nothing.+ const config = window.localStorage.getItem(key);++ if (config) {+ try {+ return JSON.parse(config);+ } catch (e) {++ // Somehow incorrect data ended up in the storage. Clean+ // up.+ window.localStorage.removeItem(key);+ }+ }++ throw error;+ })+ );}