|
@@ -0,0 +1,55 @@
|
|
1
|
+import {
|
|
2
|
+ CONNECTION_ESTABLISHED,
|
|
3
|
+ getURLWithoutParams
|
|
4
|
+} from '../base/connection';
|
|
5
|
+import { MiddlewareRegistry } from '../base/redux';
|
|
6
|
+
|
|
7
|
+MiddlewareRegistry.register(store => next => action => {
|
|
8
|
+ switch (action.type) {
|
|
9
|
+ case CONNECTION_ESTABLISHED:
|
|
10
|
+ return _connectionEstablished(store, next, action);
|
|
11
|
+ }
|
|
12
|
+
|
|
13
|
+ return next(action);
|
|
14
|
+});
|
|
15
|
+
|
|
16
|
+/**
|
|
17
|
+ * Notifies the feature app that the action {@link CONNECTION_ESTABLISHED} is
|
|
18
|
+ * being dispatched within a specific Redux {@code store}.
|
|
19
|
+ *
|
|
20
|
+ * @param {Store} store - The Redux store in which the specified {@code action}
|
|
21
|
+ * is being dispatched.
|
|
22
|
+ * @param {Dispatch} next - The Redux {@code dispatch} function to dispatch the
|
|
23
|
+ * specified {@code action} to the specified {@code store}.
|
|
24
|
+ * @param {Action} action - The Redux action {@code CONNECTION_ESTABLISHED}
|
|
25
|
+ * which is being dispatched in the specified {@code store}.
|
|
26
|
+ * @private
|
|
27
|
+ * @returns {Object} The new state that is the result of the reduction of the
|
|
28
|
+ * specified {@code action}.
|
|
29
|
+ */
|
|
30
|
+function _connectionEstablished(store, next, action) {
|
|
31
|
+ const result = next(action);
|
|
32
|
+
|
|
33
|
+ // In the Web app we explicitly do not want to display the hash and
|
|
34
|
+ // query/search URL params. Unfortunately, window.location and, more
|
|
35
|
+ // importantly, its params are used not only in jitsi-meet but also in
|
|
36
|
+ // lib-jitsi-meet. Consequenlty, the time to remove the params is
|
|
37
|
+ // determined by when no one needs them anymore.
|
|
38
|
+ const { history, location } = window;
|
|
39
|
+
|
|
40
|
+ if (history
|
|
41
|
+ && location
|
|
42
|
+ && history.length
|
|
43
|
+ && typeof history.replaceState === 'function') {
|
|
44
|
+ const replacement = getURLWithoutParams(location);
|
|
45
|
+
|
|
46
|
+ if (location !== replacement) {
|
|
47
|
+ history.replaceState(
|
|
48
|
+ history.state,
|
|
49
|
+ (document && document.title) || '',
|
|
50
|
+ replacement);
|
|
51
|
+ }
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ return result;
|
|
55
|
+}
|