@exodus/react-native-webview 11.26.1-exodus.24 → 11.26.1-exodus.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/WebViewShared.js +3 -10
- package/package.json +1 -1
package/lib/WebViewShared.js
CHANGED
|
@@ -5,10 +5,6 @@ import styles from './WebView.styles';
|
|
|
5
5
|
const defaultOriginWhitelist = ['https://*'];
|
|
6
6
|
const defaultDeeplinkWhitelist = ['https:'];
|
|
7
7
|
const defaultDeeplinkBlocklist = [`http:`, `file:`, `javascript:`];
|
|
8
|
-
const extractOrigin = (url) => {
|
|
9
|
-
const result = /^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);
|
|
10
|
-
return result === null ? '' : result[0];
|
|
11
|
-
};
|
|
12
8
|
const stringWhitelistToRegex = (originWhitelist) => new RegExp(`^${escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*')}$`);
|
|
13
9
|
const matchWithRegexList = (compiledRegexList, value) => {
|
|
14
10
|
return compiledRegexList.some(x => x.test(value));
|
|
@@ -19,18 +15,15 @@ const matchWithStringList = (prefixes, value) => {
|
|
|
19
15
|
return Array.prototype.includes.call(prefixes, value);
|
|
20
16
|
};
|
|
21
17
|
const _passesWhitelist = (compiledWhitelist, url) => {
|
|
22
|
-
const origin = extractOrigin(url);
|
|
23
|
-
if (!origin)
|
|
24
|
-
return false;
|
|
25
18
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (origin
|
|
19
|
+
const { origin } = new URL(url);
|
|
20
|
+
if (!origin)
|
|
28
21
|
return null;
|
|
22
|
+
return matchWithRegexList(compiledWhitelist, origin);
|
|
29
23
|
}
|
|
30
24
|
catch {
|
|
31
25
|
return false;
|
|
32
26
|
}
|
|
33
|
-
return matchWithRegexList(compiledWhitelist, origin);
|
|
34
27
|
};
|
|
35
28
|
const compileWhitelist = (originWhitelist) => ['about:blank', ...(originWhitelist || [])].map(stringWhitelistToRegex);
|
|
36
29
|
const urlToProtocolScheme = (url) => {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"Thibault Malbranche <malbranche.thibault@gmail.com>"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "11.26.1-exodus.
|
|
12
|
+
"version": "11.26.1-exodus.26",
|
|
13
13
|
"homepage": "https://github.com/ExodusMovement/react-native-webview#readme",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"android": "react-native run-android",
|