tangled
alpha
login
or
join now
me.webbeef.org
/
beaver
forked from
me.webbeef.org/browser.html
2
fork
atom
Rewild Your Web
2
fork
atom
overview
issues
pulls
pipelines
search: Allow about: urls
webbeef.tngl.sh
3 weeks ago
a8fc4a27
12f7d2c1
+6
-4
1 changed file
expand all
collapse all
unified
split
ui
shared
search
utils.js
+6
-4
ui/shared/search/utils.js
···
6
6
* @returns {boolean} - True if it looks like a URL
7
7
*/
8
8
export function isUrl(str) {
9
9
+
if (URL.parse(str) != null) {
10
10
+
return true;
11
11
+
}
12
12
+
9
13
return (
10
14
str.includes(".") &&
11
15
!str.includes(" ") &&
12
12
-
(str.startsWith("file://") ||
13
13
-
str.startsWith("http://") ||
14
14
-
str.startsWith("https://") ||
15
15
-
/^[a-zA-Z0-9][-a-zA-Z0-9]*\.[a-zA-Z]{2,}/.test(str))
16
16
+
URL.parse(`https://${str}`) != null
16
17
);
17
18
}
18
19
···
23
24
*/
24
25
export function normalizeUrl(url) {
25
26
if (
27
27
+
!url.startsWith("about:") &&
26
28
!url.startsWith("file://") &&
27
29
!url.startsWith("http://") &&
28
30
!url.startsWith("https://")