瀏覽代碼

feat(unsupported): provide custom blacklist for branding

master
Leonard Kim 5 年之前
父節點
當前提交
cf23045f8d

+ 3
- 23
react/features/app/getRouteToRender.js 查看文件

4
 import type { Component } from 'react';
4
 import type { Component } from 'react';
5
 
5
 
6
 import { isRoomValid } from '../base/conference';
6
 import { isRoomValid } from '../base/conference';
7
-import JitsiMeetJS from '../base/lib-jitsi-meet';
8
-import { Platform } from '../base/react';
9
 import { toState } from '../base/redux';
7
 import { toState } from '../base/redux';
8
+import { isSupportedBrowser } from '../base/environment';
10
 import { Conference } from '../conference';
9
 import { Conference } from '../conference';
11
 import { getDeepLinkingPage } from '../deep-linking';
10
 import { getDeepLinkingPage } from '../deep-linking';
12
 import { UnsupportedDesktopBrowser } from '../unsupported-browser';
11
 import { UnsupportedDesktopBrowser } from '../unsupported-browser';
98
         .then(deepLinkComponent => {
97
         .then(deepLinkComponent => {
99
             if (deepLinkComponent) {
98
             if (deepLinkComponent) {
100
                 route.component = deepLinkComponent;
99
                 route.component = deepLinkComponent;
101
-            } else if (_isSupportedBrowser()) {
100
+            } else if (isSupportedBrowser()) {
102
                 route.component = Conference;
101
                 route.component = Conference;
103
             } else {
102
             } else {
104
                 route.component = UnsupportedDesktopBrowser;
103
                 route.component = UnsupportedDesktopBrowser;
118
     const route = _getEmptyRoute();
117
     const route = _getEmptyRoute();
119
 
118
 
120
     if (isWelcomePageUserEnabled(state)) {
119
     if (isWelcomePageUserEnabled(state)) {
121
-        if (_isSupportedBrowser()) {
120
+        if (isSupportedBrowser()) {
122
             route.component = WelcomePage;
121
             route.component = WelcomePage;
123
         } else {
122
         } else {
124
             route.component = UnsupportedDesktopBrowser;
123
             route.component = UnsupportedDesktopBrowser;
135
     return Promise.resolve(route);
134
     return Promise.resolve(route);
136
 }
135
 }
137
 
136
 
138
-/**
139
- * Returns whether or not the current browser should allow the app to display.
140
- *
141
- * @returns {boolean}
142
- */
143
-function _isSupportedBrowser() {
144
-    if (navigator.product === 'ReactNative') {
145
-        return false;
146
-    }
147
-
148
-    // We are intentionally allow mobile browsers because:
149
-    // - the WelcomePage is mobile ready;
150
-    // - if the URL points to a conference, getDeepLinkingPage will take
151
-    //   care of it.
152
-    return Platform.OS === 'android'
153
-        || Platform.OS === 'ios'
154
-        || JitsiMeetJS.isWebRtcSupported();
155
-}
156
-
157
 /**
137
 /**
158
  * Returns the default {@code Route}.
138
  * Returns the default {@code Route}.
159
  *
139
  *

+ 25
- 0
react/features/base/environment/environment.js 查看文件

1
+// @flow
2
+
3
+import JitsiMeetJS from '../lib-jitsi-meet';
4
+import { Platform } from '../react';
5
+
6
+import { isBlacklistedEnvironment } from './isBlacklistedEnvironment';
7
+
8
+/**
9
+ * Returns whether or not the current browser should allow the app to display.
10
+ *
11
+ * @returns {boolean}
12
+ */
13
+export function isSupportedBrowser() {
14
+    if (navigator.product === 'ReactNative' || isBlacklistedEnvironment()) {
15
+        return false;
16
+    }
17
+
18
+    // We are intentionally allow mobile browsers because:
19
+    // - the WelcomePage is mobile ready;
20
+    // - if the URL points to a conference then deep-linking will take
21
+    //   care of it.
22
+    return Platform.OS === 'android'
23
+        || Platform.OS === 'ios'
24
+        || JitsiMeetJS.isWebRtcSupported();
25
+}

+ 1
- 0
react/features/base/environment/index.js 查看文件

1
+export * from './environment';

+ 11
- 0
react/features/base/environment/isBlacklistedEnvironment.js 查看文件

1
+/**
2
+ * Returns whether or not the current browser is supported for showing meeting
3
+ * based on any custom overrides. This file should be overridden with branding
4
+ * as needed to fit deployment needs.
5
+ *
6
+ * @returns {boolean} True the browser is unsupported due to being  blacklisted
7
+ * by the logic within this function.
8
+ */
9
+export function isBlacklistedEnvironment() {
10
+    return false;
11
+}

Loading…
取消
儲存