fix(recent-list) do not store room when inside an iframe
Due to local storage limitations we might end up making the URL huge when we save the state there. Avoid the issue at the root by never storing URLs in that case. Closes: https://github.com/jitsi/jitsi-meet/issues/11567
This commit is contained in:
parent
7f2fec756d
commit
d9eedb0dad
|
@ -1009,7 +1009,8 @@ var config = {
|
||||||
// Disables all invite functions from the app (share, invite, dial out...etc)
|
// Disables all invite functions from the app (share, invite, dial out...etc)
|
||||||
// disableInviteFunctions: true,
|
// disableInviteFunctions: true,
|
||||||
|
|
||||||
// Disables storing the room name to the recents list
|
// Disables storing the room name to the recents list. When in an iframe this is ignored and
|
||||||
|
// the room is never stored in the recents list.
|
||||||
// doNotStoreRoom: true,
|
// doNotStoreRoom: true,
|
||||||
|
|
||||||
// Deployment specific URLs.
|
// Deployment specific URLs.
|
||||||
|
|
|
@ -12,6 +12,7 @@ import JitsiMeetJS, {
|
||||||
} from '../base/lib-jitsi-meet';
|
} from '../base/lib-jitsi-meet';
|
||||||
import { isAnalyticsEnabled } from '../base/lib-jitsi-meet/functions';
|
import { isAnalyticsEnabled } from '../base/lib-jitsi-meet/functions';
|
||||||
import { getJitsiMeetGlobalNS, loadScript, parseURIString } from '../base/util';
|
import { getJitsiMeetGlobalNS, loadScript, parseURIString } from '../base/util';
|
||||||
|
import { inIframe } from '../base/util/iframeUtils';
|
||||||
|
|
||||||
import { AmplitudeHandler, MatomoHandler } from './handlers';
|
import { AmplitudeHandler, MatomoHandler } from './handlers';
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
@ -221,24 +222,6 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether we are loaded in iframe.
|
|
||||||
*
|
|
||||||
* @returns {boolean} Returns {@code true} if loaded in iframe.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
export function inIframe() {
|
|
||||||
if (navigator.product === 'ReactNative') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return window.self !== window.top;
|
|
||||||
} catch (e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to load the scripts for the external analytics handlers and creates them.
|
* Tries to load the scripts for the external analytics handlers and creates them.
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,6 +4,7 @@ import Bourne from '@hapi/bourne';
|
||||||
import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
|
import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
|
||||||
|
|
||||||
import { browser } from '../lib-jitsi-meet';
|
import { browser } from '../lib-jitsi-meet';
|
||||||
|
import { inIframe } from '../util/iframeUtils';
|
||||||
import { parseURLParams } from '../util/parseURLParams';
|
import { parseURLParams } from '../util/parseURLParams';
|
||||||
|
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
@ -11,19 +12,6 @@ import logger from './logger';
|
||||||
declare var APP: Object;
|
declare var APP: Object;
|
||||||
declare var config: Object;
|
declare var config: Object;
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether we are loaded in an iframe.
|
|
||||||
*
|
|
||||||
* @returns {boolean} Returns {@code true} if loaded in iframe.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function _inIframe() {
|
|
||||||
try {
|
|
||||||
return window.self !== window.top;
|
|
||||||
} catch (e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles changes of the fake local storage.
|
* Handles changes of the fake local storage.
|
||||||
|
@ -55,7 +43,7 @@ function shouldUseHostPageLocalStorage(urlParams) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.isWebKitBased() && _inIframe()) {
|
if (browser.isWebKitBased() && inIframe()) {
|
||||||
// WebKit browsers don't persist local storage for third-party iframes.
|
// WebKit browsers don't persist local storage for third-party iframes.
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* Checks whether we are loaded in iframe.
|
||||||
|
*
|
||||||
|
* @returns Whether the current page is loaded in an iframe.
|
||||||
|
*/
|
||||||
|
export function inIframe(): boolean {
|
||||||
|
if (navigator.product === 'ReactNative') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return window.self !== window.top;
|
||||||
|
} catch (e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import {
|
||||||
import { addKnownDomains } from '../base/known-domains';
|
import { addKnownDomains } from '../base/known-domains';
|
||||||
import { MiddlewareRegistry } from '../base/redux';
|
import { MiddlewareRegistry } from '../base/redux';
|
||||||
import { parseURIString } from '../base/util';
|
import { parseURIString } from '../base/util';
|
||||||
|
import { inIframe } from '../base/util/iframeUtils';
|
||||||
|
|
||||||
import { _storeCurrentConference, _updateConferenceDuration } from './actions';
|
import { _storeCurrentConference, _updateConferenceDuration } from './actions';
|
||||||
import { isRecentListEnabled } from './functions';
|
import { isRecentListEnabled } from './functions';
|
||||||
|
@ -88,7 +89,7 @@ function _appWillMount({ dispatch, getState }, next, action) {
|
||||||
function _conferenceWillLeave({ dispatch, getState }, next, action) {
|
function _conferenceWillLeave({ dispatch, getState }, next, action) {
|
||||||
const { doNotStoreRoom } = getState()['features/base/config'];
|
const { doNotStoreRoom } = getState()['features/base/config'];
|
||||||
|
|
||||||
if (!doNotStoreRoom) {
|
if (!doNotStoreRoom && !inIframe()) {
|
||||||
let locationURL;
|
let locationURL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +129,7 @@ function _conferenceWillLeave({ dispatch, getState }, next, action) {
|
||||||
function _setRoom({ dispatch, getState }, next, action) {
|
function _setRoom({ dispatch, getState }, next, action) {
|
||||||
const { doNotStoreRoom } = getState()['features/base/config'];
|
const { doNotStoreRoom } = getState()['features/base/config'];
|
||||||
|
|
||||||
if (!doNotStoreRoom && action.room) {
|
if (!doNotStoreRoom && !inIframe() && action.room) {
|
||||||
const { locationURL } = getState()['features/base/connection'];
|
const { locationURL } = getState()['features/base/connection'];
|
||||||
|
|
||||||
if (locationURL) {
|
if (locationURL) {
|
||||||
|
|
Loading…
Reference in New Issue