Browse Source

Fix url params stripping

j8
Ilya Daynatovich 8 years ago
parent
commit
ad9bdf4dd2

+ 0
- 2
react/features/conference/components/Conference.web.js View File

@@ -6,7 +6,6 @@ import {
6 6
     connect,
7 7
     disconnect
8 8
 } from '../../base/connection';
9
-import { obtainConfigAndInit } from '../actions';
10 9
 
11 10
 /**
12 11
  * For legacy reasons, inline style for display none.
@@ -28,7 +27,6 @@ class Conference extends Component {
28 27
      * @inheritdoc
29 28
      */
30 29
     componentDidMount() {
31
-        this.props.dispatch(obtainConfigAndInit());
32 30
         APP.UI.start();
33 31
 
34 32
         // XXX Temporary solution until we add React translation.

+ 67
- 1
react/features/conference/functions.js View File

@@ -1,5 +1,71 @@
1
-/* global APP */
1
+/* global APP, config */
2 2
 import HttpConfigFetch from '../../../modules/config/HttpConfigFetch';
3
+import ConferenceUrl from '../../../modules/URL/ConferenceUrl';
4
+import BoshAddressChoice from '../../../modules/config/BoshAddressChoice';
5
+const logger = require('jitsi-meet-logger').getLogger(__filename);
6
+
7
+/**
8
+ * If we have an HTTP endpoint for getting config.json configured
9
+ * we're going to read it and override properties from config.js and
10
+ * interfaceConfig.js. If there is no endpoint we'll just
11
+ * continue with initialization.
12
+ * Keep in mind that if the endpoint has been configured and we fail
13
+ * to obtain the config for any reason then the conference won't
14
+ * start and error message will be displayed to the user.
15
+ *
16
+ * @returns {Function}
17
+ */
18
+export function obtainConfigAndInit() {
19
+    // Skip initialization if conference is already initialized
20
+    if (!APP.ConferenceUrl) {
21
+        const room = APP.conference.roomName;
22
+
23
+        if (config.configLocation) {
24
+            const location = config.configLocation;
25
+
26
+            obtainConfig(location, room)
27
+                .then(_obtainConfigHandler)
28
+                .then(_initConference)
29
+                .catch(err => {
30
+                    // Show obtain config error,
31
+                    // pass the error object for report
32
+                    APP.UI.messageHandler.openReportDialog(
33
+                        null, 'dialog.connectError', err);
34
+                });
35
+        } else {
36
+            BoshAddressChoice.chooseAddress(config, room);
37
+            _initConference();
38
+        }
39
+    }
40
+}
41
+
42
+/**
43
+ * Obtain config handler.
44
+ *
45
+ * @returns {Promise}
46
+ * @private
47
+ */
48
+function _obtainConfigHandler() {
49
+    const now = window.performance.now();
50
+
51
+    APP.connectionTimes['configuration.fetched'] = now;
52
+    logger.log('(TIME) configuration fetched:\t', now);
53
+
54
+    return Promise.resolve();
55
+}
56
+
57
+/**
58
+ *  Initialization of the app.
59
+ *
60
+ *  @returns {void}
61
+ *  @private
62
+ */
63
+function _initConference() {
64
+    setTokenData();
65
+
66
+    // Initialize the conference URL handler
67
+    APP.ConferenceUrl = new ConferenceUrl(window.location);
68
+}
3 69
 
4 70
 /**
5 71
  * Promise wrapper on obtain config method.

+ 7
- 1
react/features/conference/route.js View File

@@ -1,11 +1,17 @@
1 1
 import { RouteRegistry } from '../base/navigator';
2 2
 
3 3
 import { Conference } from './components';
4
+import { obtainConfigAndInit } from './functions';
4 5
 
5 6
 /**
6 7
  * Register route for Conference (page).
7 8
  */
8 9
 RouteRegistry.register({
9 10
     component: Conference,
10
-    path: '/:room'
11
+    path: '/:room',
12
+    onEnter: () => {
13
+        // XXX: If config or jwt are set by hash or query parameters
14
+        // Getting raw URL before stripping it.
15
+        obtainConfigAndInit();
16
+    }
11 17
 });

Loading…
Cancel
Save