|
|
@@ -8,6 +8,7 @@ import { parseURLParams } from '../util/parseURLParams';
|
|
8
|
8
|
import logger from './logger';
|
|
9
|
9
|
|
|
10
|
10
|
declare var APP: Object;
|
|
|
11
|
+declare var config: Object;
|
|
11
|
12
|
|
|
12
|
13
|
/**
|
|
13
|
14
|
* Handles changes of the fake local storage.
|
|
|
@@ -18,15 +19,43 @@ function onFakeLocalStorageChanged() {
|
|
18
|
19
|
APP.API.notifyLocalStorageChanged(jitsiLocalStorage.serialize());
|
|
19
|
20
|
}
|
|
20
|
21
|
|
|
|
22
|
+/**
|
|
|
23
|
+ * Checks if the local storage of the host page needs to be used instead jitsi-meet's local storage.
|
|
|
24
|
+ *
|
|
|
25
|
+ * @param {Object} urlParams - Object with parsed URL params.
|
|
|
26
|
+ * @returns {boolean} - True if the local storage of the host page needs to be used instead jitsi-meet's local storage
|
|
|
27
|
+ * and false otherwise.
|
|
|
28
|
+ */
|
|
|
29
|
+function shouldUseHostPageLocalStorage(urlParams) {
|
|
|
30
|
+ // NOTE: normally the url params and the config will be merged into the redux store. But we want to setup the local
|
|
|
31
|
+ // storage as soon as possible, the store is not created yet and the merging of the URL params and the config
|
|
|
32
|
+ // haven't been executed yet. That's why we need to manually parse the URL params and also access the config trough
|
|
|
33
|
+ // the global variable.
|
|
|
34
|
+ if (urlParams['config.useHostPageLocalStorage'] === true
|
|
|
35
|
+ || (typeof config === 'object' && config.useHostPageLocalStorage)) {
|
|
|
36
|
+ return true;
|
|
|
37
|
+ }
|
|
|
38
|
+
|
|
|
39
|
+ if (jitsiLocalStorage.isLocalStorageDisabled()) { // We have detected that ou own local storage is not working.
|
|
|
40
|
+ return true;
|
|
|
41
|
+ }
|
|
|
42
|
+
|
|
|
43
|
+ if (browser.isWebKitBased()) { // Webkit browsers don't persist local storage for third-party iframes.
|
|
|
44
|
+ return true;
|
|
|
45
|
+ }
|
|
|
46
|
+
|
|
|
47
|
+ return false;
|
|
|
48
|
+}
|
|
|
49
|
+
|
|
21
|
50
|
/**
|
|
22
|
51
|
* Performs initial setup of the jitsiLocalStorage.
|
|
23
|
52
|
*
|
|
24
|
53
|
* @returns {void}
|
|
25
|
54
|
*/
|
|
26
|
55
|
function setupJitsiLocalStorage() {
|
|
27
|
|
- if (jitsiLocalStorage.isLocalStorageDisabled() || browser.isWebKitBased()) {
|
|
28
|
|
- const urlParams = parseURLParams(window.location);
|
|
|
56
|
+ const urlParams = parseURLParams(window.location);
|
|
29
|
57
|
|
|
|
58
|
+ if (shouldUseHostPageLocalStorage(urlParams)) {
|
|
30
|
59
|
try {
|
|
31
|
60
|
const localStorageContent = JSON.parse(urlParams['appData.localStorageContent']);
|
|
32
|
61
|
|