feat(config): Add useHostPageLocalStorage
This commit is contained in:
parent
b559cb8ec6
commit
8f06866646
|
@ -666,6 +666,11 @@ var config = {
|
|||
// Sets the conference subject
|
||||
// subject: 'Conference Subject',
|
||||
|
||||
// This property is related to the use case when jitsi-meet is used via the IFrame API. When the property is true
|
||||
// jitsi-meet will use the local storage of the host page instead of its own. This option is useful if the browser
|
||||
// is not persisting the local storage inside the iframe.
|
||||
// useHostPageLocalStorage: true,
|
||||
|
||||
// List of undocumented settings used in jitsi-meet
|
||||
/**
|
||||
_immediateReloadThreshold
|
||||
|
|
|
@ -157,6 +157,7 @@ export default [
|
|||
'stereo',
|
||||
'subject',
|
||||
'testing',
|
||||
'useHostPageLocalStorage',
|
||||
'useTurnUdp',
|
||||
'videoQuality.persist',
|
||||
'webrtcIceTcpDisable',
|
||||
|
|
|
@ -8,6 +8,7 @@ import { parseURLParams } from '../util/parseURLParams';
|
|||
import logger from './logger';
|
||||
|
||||
declare var APP: Object;
|
||||
declare var config: Object;
|
||||
|
||||
/**
|
||||
* Handles changes of the fake local storage.
|
||||
|
@ -18,15 +19,43 @@ function onFakeLocalStorageChanged() {
|
|||
APP.API.notifyLocalStorageChanged(jitsiLocalStorage.serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the local storage of the host page needs to be used instead jitsi-meet's local storage.
|
||||
*
|
||||
* @param {Object} urlParams - Object with parsed URL params.
|
||||
* @returns {boolean} - True if the local storage of the host page needs to be used instead jitsi-meet's local storage
|
||||
* and false otherwise.
|
||||
*/
|
||||
function shouldUseHostPageLocalStorage(urlParams) {
|
||||
// NOTE: normally the url params and the config will be merged into the redux store. But we want to setup the local
|
||||
// storage as soon as possible, the store is not created yet and the merging of the URL params and the config
|
||||
// haven't been executed yet. That's why we need to manually parse the URL params and also access the config trough
|
||||
// the global variable.
|
||||
if (urlParams['config.useHostPageLocalStorage'] === true
|
||||
|| (typeof config === 'object' && config.useHostPageLocalStorage)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jitsiLocalStorage.isLocalStorageDisabled()) { // We have detected that ou own local storage is not working.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.isWebKitBased()) { // Webkit browsers don't persist local storage for third-party iframes.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs initial setup of the jitsiLocalStorage.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function setupJitsiLocalStorage() {
|
||||
if (jitsiLocalStorage.isLocalStorageDisabled() || browser.isWebKitBased()) {
|
||||
const urlParams = parseURLParams(window.location);
|
||||
const urlParams = parseURLParams(window.location);
|
||||
|
||||
if (shouldUseHostPageLocalStorage(urlParams)) {
|
||||
try {
|
||||
const localStorageContent = JSON.parse(urlParams['appData.localStorageContent']);
|
||||
|
||||
|
|
Loading…
Reference in New Issue