소스 검색

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.
j8
Saúl Ibarra Corretgé 6 년 전
부모
커밋
1feff9709c
4개의 변경된 파일4개의 추가작업 그리고 117개의 파일을 삭제
  1. 0
    10
      config.js
  2. 0
    65
      react/features/base/config/functions.any.js
  3. 3
    15
      react/features/base/config/getRoomName.js
  4. 1
    27
      react/features/conference/components/web/Conference.js

+ 0
- 10
config.js 파일 보기

1
 /* eslint-disable no-unused-vars, no-var */
1
 /* eslint-disable no-unused-vars, no-var */
2
 
2
 
3
 var config = {
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
     // Connection
4
     // Connection
15
     //
5
     //
16
 
6
 

+ 0
- 65
react/features/base/config/functions.any.js 파일 보기

8
 import parseURLParams from './parseURLParams';
8
 import parseURLParams from './parseURLParams';
9
 import logger from './logger';
9
 import logger from './logger';
10
 
10
 
11
-declare var $: Object;
12
-
13
 // XXX The functions getRoomName and parseURLParams are split out of
11
 // XXX The functions getRoomName and parseURLParams are split out of
14
 // functions.js because they are bundled in both app.bundle and
12
 // functions.js because they are bundled in both app.bundle and
15
 // do_external_connect, webpack 1 does not support tree shaking, and we don't
13
 // do_external_connect, webpack 1 does not support tree shaking, and we don't
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
 /* eslint-disable max-params, no-shadow */
41
 /* eslint-disable max-params, no-shadow */
107
 
42
 
108
 /**
43
 /**

+ 3
- 15
react/features/base/config/getRoomName.js 파일 보기

1
-/* @flow */
1
+// @flow
2
 
2
 
3
 import { getBackendSafeRoomName } from '../util';
3
 import { getBackendSafeRoomName } from '../util';
4
 
4
 
5
-declare var config: Object;
6
-
7
 /**
5
 /**
8
  * Builds and returns the room name.
6
  * Builds and returns the room name.
9
  *
7
  *
10
  * @returns {string}
8
  * @returns {string}
11
  */
9
  */
12
 export default function getRoomName(): ?string {
10
 export default function getRoomName(): ?string {
13
-    const { getroomnode } = config;
14
     const path = window.location.pathname;
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
     return getBackendSafeRoomName(roomName);
16
     return getBackendSafeRoomName(roomName);
29
 }
17
 }

+ 1
- 27
react/features/conference/components/web/Conference.js 파일 보기

5
 
5
 
6
 import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
6
 import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
7
 
7
 
8
-import { obtainConfig } from '../../../base/config';
9
 import { connect, disconnect } from '../../../base/connection';
8
 import { connect, disconnect } from '../../../base/connection';
10
 import { translate } from '../../../base/i18n';
9
 import { translate } from '../../../base/i18n';
11
 import { connect as reactReduxConnect } from '../../../base/redux';
10
 import { connect as reactReduxConnect } from '../../../base/redux';
23
 } from '../../../toolbox';
22
 } from '../../../toolbox';
24
 
23
 
25
 import { maybeShowSuboptimalExperienceNotification } from '../../functions';
24
 import { maybeShowSuboptimalExperienceNotification } from '../../functions';
26
-import logger from '../../logger';
27
 
25
 
28
 import Labels from './Labels';
26
 import Labels from './Labels';
29
 import { default as Notice } from './Notice';
27
 import { default as Notice } from './Notice';
123
      */
121
      */
124
     componentDidMount() {
122
     componentDidMount() {
125
         document.title = interfaceConfig.APP_NAME;
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…
취소
저장