mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-16 16:47:24 +00:00
feat: add https protocol to urls without protocol in Browser
This commit is contained in:
parent
c804bb243a
commit
35b8699f9f
@ -130,7 +130,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (appSettings.shouldShowBrowserSearchEngine !== Constants.browserSearchEngineNone && !Utils.isURL(text)) {
|
if (appSettings.shouldShowBrowserSearchEngine !== Constants.browserSearchEngineNone && !Utils.isURL(text) && !Utils.isURLWithOptionalProtocol(text)) {
|
||||||
switch (appSettings.shouldShowBrowserSearchEngine) {
|
switch (appSettings.shouldShowBrowserSearchEngine) {
|
||||||
case Constants.browserSearchEngineGoogle: currentWebView.url = "https://www.google.com/search?q=" + text; break;
|
case Constants.browserSearchEngineGoogle: currentWebView.url = "https://www.google.com/search?q=" + text; break;
|
||||||
case Constants.browserSearchEngineYahoo: currentWebView.url = "https://search.yahoo.com/search?p=" + text; break;
|
case Constants.browserSearchEngineYahoo: currentWebView.url = "https://search.yahoo.com/search?p=" + text; break;
|
||||||
@ -138,6 +138,8 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
} else if (Utils.isURLWithOptionalProtocol(text)) {
|
||||||
|
text = "https://" + text
|
||||||
}
|
}
|
||||||
|
|
||||||
currentWebView.url = determineRealURL(text);
|
currentWebView.url = determineRealURL(text);
|
||||||
|
@ -337,6 +337,10 @@ QtObject {
|
|||||||
return (/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(text))
|
return (/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isURLWithOptionalProtocol(text) {
|
||||||
|
return (/^(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(text))
|
||||||
|
}
|
||||||
|
|
||||||
function isHexColor(c) {
|
function isHexColor(c) {
|
||||||
return (/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/i.test(c))
|
return (/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/i.test(c))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user