diff options
author | ManeraKai <manerakai@protonmail.com> | 2022-03-10 10:57:10 +0300 |
---|---|---|
committer | ManeraKai <manerakai@protonmail.com> | 2022-03-10 10:57:10 +0300 |
commit | 519f9e959476e01670c9b2afc2e3b042879d4f8a (patch) | |
tree | b49713e0af2d8089cccf45b760eaacb66063176a /src/assets | |
parent | Added send, fixed a bug in #89 (diff) | |
download | libredirect-519f9e959476e01670c9b2afc2e3b042879d4f8a.zip |
Added startpage #52
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/javascripts/helpers/search.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js index 66d8300a..b90c201c 100644 --- a/src/assets/javascripts/helpers/search.js +++ b/src/assets/javascripts/helpers/search.js @@ -17,6 +17,10 @@ let redirects = { "normal": [], "tor": [] }, + "startpage": { + "normal": "https://www.startpage.com", + "tor": null + } }; const getRedirects = () => redirects; const getCustomRedirects = () => { @@ -154,13 +158,10 @@ function setProtocol(val) { console.log("searchProtocol: ", val) } -function isSearch(url) { - if (disable) return false; - return targets.some((rx) => rx.test(url.href)); -} - function redirect(url) { - console.log(url.href); + if (disable) return; + if (!targets.some((rx) => rx.test(url.href))) return; + let randomInstance; let path; if (frontend == 'searx') { @@ -171,7 +172,7 @@ function redirect(url) { randomInstance = commonHelper.getRandomInstance(instancesList) path = "/"; } - if (frontend == 'whoogle') { + else if (frontend == 'whoogle') { let instancesList if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects]; if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]; @@ -179,6 +180,10 @@ function redirect(url) { randomInstance = commonHelper.getRandomInstance(instancesList) path = "/search"; } + else if (frontend == 'startpage') { + randomInstance = redirects.startpage.normal; + path = "/do/search"; + } let searchQuery = ""; url.search.slice(1).split("&").forEach((input) => { @@ -282,7 +287,6 @@ async function init() { } export default { - isSearch, getDisable, setDisable, |