瀏覽代碼

config: drop configLocation and getroomnode options

They never worked on mobile and pose an impediment for makinf config.js more
future proof. Specially if we want to move to a non-executable form of
configuration.
master
Saúl Ibarra Corretgé 5 年之前
父節點
當前提交
1feff9709c

+ 0
- 10
config.js 查看文件

@@ -1,16 +1,6 @@
1 1
 /* eslint-disable no-unused-vars, no-var */
2 2
 
3 3
 var config = {
4
-    // Configuration
5
-    //
6
-
7
-    // Alternative location for the configuration.
8
-    // configLocation: './config.json',
9
-
10
-    // Custom function which given the URL path should return a room name.
11
-    // getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
12
-
13
-
14 4
     // Connection
15 5
     //
16 6
 

+ 0
- 65
react/features/base/config/functions.any.js 查看文件

@@ -8,8 +8,6 @@ import INTERFACE_CONFIG_WHITELIST from './interfaceConfigWhitelist';
8 8
 import parseURLParams from './parseURLParams';
9 9
 import logger from './logger';
10 10
 
11
-declare var $: Object;
12
-
13 11
 // XXX The functions getRoomName and parseURLParams are split out of
14 12
 // functions.js because they are bundled in both app.bundle and
15 13
 // do_external_connect, webpack 1 does not support tree shaking, and we don't
@@ -40,69 +38,6 @@ export function createFakeConfig(baseURL: string) {
40 38
     };
41 39
 }
42 40
 
43
-/**
44
- * Promise wrapper on obtain config method. When HttpConfigFetch will be moved
45
- * to React app it's better to use load config instead.
46
- *
47
- * @param {string} location - URL of the domain from which the config is to be
48
- * obtained.
49
- * @param {string} room - Room name.
50
- * @private
51
- * @returns {Promise<void>}
52
- */
53
-export function obtainConfig(location: string, room: string): Promise<void> {
54
-    return new Promise((resolve, reject) =>
55
-        _obtainConfig(location, room, (success, error) => {
56
-            success ? resolve() : reject(error);
57
-        })
58
-    );
59
-}
60
-
61
-/**
62
- * Sends HTTP POST request to specified {@code endpoint}. In request the name
63
- * of the room is included in JSON format:
64
- * {
65
- *     "rooomName": "someroom12345"
66
- * }.
67
- *
68
- * @param {string} endpoint - The name of HTTP endpoint to which to send
69
- * the HTTP POST request.
70
- * @param {string} roomName - The name of the conference room for which config
71
- * is requested.
72
- * @param {Function} complete - The callback to invoke upon success or failure.
73
- * @returns {void}
74
- */
75
-function _obtainConfig(endpoint: string, roomName: string, complete: Function) {
76
-    logger.info(`Send config request to ${endpoint} for room: ${roomName}`);
77
-    $.ajax(
78
-        endpoint,
79
-        {
80
-            contentType: 'application/json',
81
-            data: JSON.stringify({ roomName }),
82
-            dataType: 'json',
83
-            method: 'POST',
84
-
85
-            error(jqXHR, textStatus, errorThrown) {
86
-                logger.error('Get config error: ', jqXHR, errorThrown);
87
-                complete(false, `Get config response status: ${textStatus}`);
88
-            },
89
-            success(data) {
90
-                const { config, interfaceConfig, loggingConfig } = window;
91
-
92
-                try {
93
-                    overrideConfigJSON(
94
-                        config, interfaceConfig, loggingConfig,
95
-                        data);
96
-                    complete(true);
97
-                } catch (e) {
98
-                    logger.error('Parse config error: ', e);
99
-                    complete(false, e);
100
-                }
101
-            }
102
-        }
103
-    );
104
-}
105
-
106 41
 /* eslint-disable max-params, no-shadow */
107 42
 
108 43
 /**

+ 3
- 15
react/features/base/config/getRoomName.js 查看文件

@@ -1,29 +1,17 @@
1
-/* @flow */
1
+// @flow
2 2
 
3 3
 import { getBackendSafeRoomName } from '../util';
4 4
 
5
-declare var config: Object;
6
-
7 5
 /**
8 6
  * Builds and returns the room name.
9 7
  *
10 8
  * @returns {string}
11 9
  */
12 10
 export default function getRoomName(): ?string {
13
-    const { getroomnode } = config;
14 11
     const path = window.location.pathname;
15
-    let roomName;
16 12
 
17
-    // Determine the room node from the URL.
18
-    if (getroomnode && typeof getroomnode === 'function') {
19
-        roomName = getroomnode.call(config, path);
20
-    } else {
21
-        // Fall back to the default strategy of making assumptions about how the
22
-        // URL maps to the room (name). It currently assumes a deployment in
23
-        // which the last non-directory component of the path (name) is the
24
-        // room.
25
-        roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
26
-    }
13
+    // The last non-directory component of the path (name) is the room.
14
+    const roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
27 15
 
28 16
     return getBackendSafeRoomName(roomName);
29 17
 }

+ 1
- 27
react/features/conference/components/web/Conference.js 查看文件

@@ -5,7 +5,6 @@ import React from 'react';
5 5
 
6 6
 import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
7 7
 
8
-import { obtainConfig } from '../../../base/config';
9 8
 import { connect, disconnect } from '../../../base/connection';
10 9
 import { translate } from '../../../base/i18n';
11 10
 import { connect as reactReduxConnect } from '../../../base/redux';
@@ -23,7 +22,6 @@ import {
23 22
 } from '../../../toolbox';
24 23
 
25 24
 import { maybeShowSuboptimalExperienceNotification } from '../../functions';
26
-import logger from '../../logger';
27 25
 
28 26
 import Labels from './Labels';
29 27
 import { default as Notice } from './Notice';
@@ -123,31 +121,7 @@ class Conference extends AbstractConference<Props, *> {
123 121
      */
124 122
     componentDidMount() {
125 123
         document.title = interfaceConfig.APP_NAME;
126
-
127
-        const { configLocation } = config;
128
-
129
-        if (configLocation) {
130
-            obtainConfig(configLocation, this.props._room)
131
-                .then(() => {
132
-                    const now = window.performance.now();
133
-
134
-                    APP.connectionTimes['configuration.fetched'] = now;
135
-                    logger.log('(TIME) configuration fetched:\t', now);
136
-
137
-                    this._start();
138
-                })
139
-                .catch(err => {
140
-                    logger.log(err);
141
-
142
-                    // Show obtain config error.
143
-                    APP.UI.messageHandler.showError({
144
-                        descriptionKey: 'dialog.connectError',
145
-                        titleKey: 'connection.CONNFAIL'
146
-                    });
147
-                });
148
-        } else {
149
-            this._start();
150
-        }
124
+        this._start();
151 125
     }
152 126
 
153 127
     /**

Loading…
取消
儲存