|
|
@@ -11,18 +11,6 @@ import {
|
|
11
|
11
|
appWillUnmount
|
|
12
|
12
|
} from '../actions';
|
|
13
|
13
|
|
|
14
|
|
-/**
|
|
15
|
|
- * Default config.
|
|
16
|
|
- *
|
|
17
|
|
- * @type {Object}
|
|
18
|
|
- */
|
|
19
|
|
-const DEFAULT_CONFIG = {
|
|
20
|
|
- configLocation: './config.js',
|
|
21
|
|
- hosts: {
|
|
22
|
|
- domain: 'meet.jit.si'
|
|
23
|
|
- }
|
|
24
|
|
-};
|
|
25
|
|
-
|
|
26
|
14
|
/**
|
|
27
|
15
|
* Base (abstract) class for main App component.
|
|
28
|
16
|
*
|
|
|
@@ -57,12 +45,7 @@ export class AbstractApp extends Component {
|
|
57
|
45
|
|
|
58
|
46
|
dispatch(localParticipantJoined());
|
|
59
|
47
|
|
|
60
|
|
- const config
|
|
61
|
|
- = typeof this.props.config === 'object'
|
|
62
|
|
- ? this.props.config
|
|
63
|
|
- : DEFAULT_CONFIG;
|
|
64
|
|
-
|
|
65
|
|
- this._openURL(this.props.url || `https://${config.hosts.domain}`);
|
|
|
48
|
+ this._openURL(this._getDefaultURL());
|
|
66
|
49
|
}
|
|
67
|
50
|
|
|
68
|
51
|
/**
|
|
|
@@ -116,6 +99,68 @@ export class AbstractApp extends Component {
|
|
116
|
99
|
return React.createElement(component, { ...thisProps, ...props });
|
|
117
|
100
|
}
|
|
118
|
101
|
|
|
|
102
|
+ /**
|
|
|
103
|
+ * Gets the default URL to be opened when this App mounts.
|
|
|
104
|
+ *
|
|
|
105
|
+ * @private
|
|
|
106
|
+ * @returns {string} The default URL to be opened when this App mounts.
|
|
|
107
|
+ */
|
|
|
108
|
+ _getDefaultURL() {
|
|
|
109
|
+ // If the URL was explicitly specified to the React Component, then open
|
|
|
110
|
+ // it.
|
|
|
111
|
+ let url = this.props.url;
|
|
|
112
|
+
|
|
|
113
|
+ if (url) {
|
|
|
114
|
+ return url;
|
|
|
115
|
+ }
|
|
|
116
|
+
|
|
|
117
|
+ // If the execution environment provides a Location abstraction, then
|
|
|
118
|
+ // this App at already at that location but it must be made aware of the
|
|
|
119
|
+ // fact.
|
|
|
120
|
+ const windowLocation = this._getWindowLocation();
|
|
|
121
|
+
|
|
|
122
|
+ if (windowLocation) {
|
|
|
123
|
+ url = windowLocation.toString();
|
|
|
124
|
+ if (url) {
|
|
|
125
|
+ return url;
|
|
|
126
|
+ }
|
|
|
127
|
+ }
|
|
|
128
|
+
|
|
|
129
|
+ // By default, open the domain configured in the configuration file
|
|
|
130
|
+ // which may be the domain at which the whole server infrastructure is
|
|
|
131
|
+ // deployed.
|
|
|
132
|
+ const config = this.props.config;
|
|
|
133
|
+
|
|
|
134
|
+ if (typeof config === 'object') {
|
|
|
135
|
+ const hosts = config.hosts;
|
|
|
136
|
+
|
|
|
137
|
+ if (typeof hosts === 'object') {
|
|
|
138
|
+ const domain = hosts.domain;
|
|
|
139
|
+
|
|
|
140
|
+ if (domain) {
|
|
|
141
|
+ return `https://${domain}`;
|
|
|
142
|
+ }
|
|
|
143
|
+ }
|
|
|
144
|
+ }
|
|
|
145
|
+
|
|
|
146
|
+ return 'https://meet.jit.si';
|
|
|
147
|
+ }
|
|
|
148
|
+
|
|
|
149
|
+ /**
|
|
|
150
|
+ * Gets a Location object from the window with information about the current
|
|
|
151
|
+ * location of the document. Explicitly defined to allow extenders to
|
|
|
152
|
+ * override because React Native does not usually have a location property
|
|
|
153
|
+ * on its window unless debugging remotely in which case the browser that is
|
|
|
154
|
+ * the remote debugger will provide a location property on the window.
|
|
|
155
|
+ *
|
|
|
156
|
+ * @protected
|
|
|
157
|
+ * @returns {Location} A Location object with information about the current
|
|
|
158
|
+ * location of the document.
|
|
|
159
|
+ */
|
|
|
160
|
+ _getWindowLocation() {
|
|
|
161
|
+ return undefined;
|
|
|
162
|
+ }
|
|
|
163
|
+
|
|
119
|
164
|
/**
|
|
120
|
165
|
* Navigates this AbstractApp to (i.e. opens) a specific URL.
|
|
121
|
166
|
*
|