浏览代码

feat(unsupported): provide custom blacklist for branding

master
Leonard Kim 5 年前
父节点
当前提交
cf23045f8d

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

@@ -4,9 +4,8 @@ import { generateRoomWithoutSeparator } from 'js-utils/random';
4 4
 import type { Component } from 'react';
5 5
 
6 6
 import { isRoomValid } from '../base/conference';
7
-import JitsiMeetJS from '../base/lib-jitsi-meet';
8
-import { Platform } from '../base/react';
9 7
 import { toState } from '../base/redux';
8
+import { isSupportedBrowser } from '../base/environment';
10 9
 import { Conference } from '../conference';
11 10
 import { getDeepLinkingPage } from '../deep-linking';
12 11
 import { UnsupportedDesktopBrowser } from '../unsupported-browser';
@@ -98,7 +97,7 @@ function _getWebConferenceRoute(state): ?Promise<Route> {
98 97
         .then(deepLinkComponent => {
99 98
             if (deepLinkComponent) {
100 99
                 route.component = deepLinkComponent;
101
-            } else if (_isSupportedBrowser()) {
100
+            } else if (isSupportedBrowser()) {
102 101
                 route.component = Conference;
103 102
             } else {
104 103
                 route.component = UnsupportedDesktopBrowser;
@@ -118,7 +117,7 @@ function _getWebWelcomePageRoute(state): Promise<Route> {
118 117
     const route = _getEmptyRoute();
119 118
 
120 119
     if (isWelcomePageUserEnabled(state)) {
121
-        if (_isSupportedBrowser()) {
120
+        if (isSupportedBrowser()) {
122 121
             route.component = WelcomePage;
123 122
         } else {
124 123
             route.component = UnsupportedDesktopBrowser;
@@ -135,25 +134,6 @@ function _getWebWelcomePageRoute(state): Promise<Route> {
135 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 138
  * Returns the default {@code Route}.
159 139
  *

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

@@ -0,0 +1,25 @@
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 查看文件

@@ -0,0 +1 @@
1
+export * from './environment';

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

@@ -0,0 +1,11 @@
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
+}

正在加载...
取消
保存