Modified some regex. Removed yahoo, ecosia #199
This commit is contained in:
parent
8b88d53dee
commit
1c5ff30f26
|
@ -19,7 +19,6 @@ body.option(dir="auto")
|
||||||
option(value="searxng") SearXNG
|
option(value="searxng") SearXNG
|
||||||
option(value="whoogle") Whoogle
|
option(value="whoogle") Whoogle
|
||||||
option(value="startpage") Startpage
|
option(value="startpage") Startpage
|
||||||
option(value="ecosia") Ecosia
|
|
||||||
|
|
||||||
|
|
||||||
#searx-whoogle
|
#searx-whoogle
|
||||||
|
|
|
@ -4,9 +4,7 @@ import commonHelper from './common.js'
|
||||||
|
|
||||||
const targets = [
|
const targets = [
|
||||||
/^https?:\/{2}(www\.|search\.|)google(\.[a-z]{2,3}){1,2}(\/search(\?.*|$)|\/$)/,
|
/^https?:\/{2}(www\.|search\.|)google(\.[a-z]{2,3}){1,2}(\/search(\?.*|$)|\/$)/,
|
||||||
/^https?:\/{2}(www\.|)bing\.com/,
|
/^https?:\/{2}(www\.|www2\.|)bing\.com/,
|
||||||
|
|
||||||
/^https?:\/{2}search\.yahoo(\.[a-z]{2,3}){1,2}/,
|
|
||||||
|
|
||||||
/^https?:\/{2}yandex(\.[a-z]{2,3}){1,2}/,
|
/^https?:\/{2}yandex(\.[a-z]{2,3}){1,2}/,
|
||||||
|
|
||||||
|
@ -31,9 +29,6 @@ let redirects = {
|
||||||
"startpage": {
|
"startpage": {
|
||||||
"normal": "https://www.startpage.com",
|
"normal": "https://www.startpage.com",
|
||||||
},
|
},
|
||||||
"ecosia": {
|
|
||||||
"normal": "https://www.ecosia.org",
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const getRedirects = () => redirects;
|
const getRedirects = () => redirects;
|
||||||
const getCustomRedirects = () => {
|
const getCustomRedirects = () => {
|
||||||
|
@ -439,20 +434,14 @@ function redirect(url) {
|
||||||
randomInstance = redirects.startpage.normal;
|
randomInstance = redirects.startpage.normal;
|
||||||
path = "/do/search";
|
path = "/do/search";
|
||||||
}
|
}
|
||||||
else if (frontend == 'ecosia') {
|
|
||||||
randomInstance = redirects.ecosia.normal;
|
|
||||||
path = '/search';
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
((url.hostname.includes('google') || url.hostname.includes('bing')) && !url.searchParams.has('q')) ||
|
((url.hostname.includes('google') || url.hostname.includes('bing')) && !url.searchParams.has('q')) ||
|
||||||
(url.hostname.includes('yahoo') && !url.searchParams.has('p')) ||
|
|
||||||
(url.hostname.includes('yandex') && !url.searchParams.has('text'))
|
(url.hostname.includes('yandex') && !url.searchParams.has('text'))
|
||||||
) path = '/';
|
) path = '/';
|
||||||
|
|
||||||
let searchQuery = "";
|
let searchQuery = "";
|
||||||
|
|
||||||
if ((url.hostname.includes('google') || url.hostname.includes('bing') || url.hostname.includes('libredirect.invalid')) && url.searchParams.has('q')) searchQuery = `?q=${url.searchParams.get('q')}`;
|
if ((url.hostname.includes('google') || url.hostname.includes('bing') || url.hostname.includes('libredirect.invalid')) && url.searchParams.has('q')) searchQuery = `?q=${url.searchParams.get('q')}`;
|
||||||
if (url.hostname.includes('yahoo') && url.searchParams.has('p')) searchQuery = `?q=${url.searchParams.get('p')}`;
|
|
||||||
if (url.hostname.includes('yandex') && url.searchParams.has('text')) searchQuery = `?q=${url.searchParams.get('text')}`;
|
if (url.hostname.includes('yandex') && url.searchParams.has('text')) searchQuery = `?q=${url.searchParams.get('text')}`;
|
||||||
|
|
||||||
return `${randomInstance}${path}${searchQuery}`;
|
return `${randomInstance}${path}${searchQuery}`;
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
<option value="searxng">SearXNG</option>
|
<option value="searxng">SearXNG</option>
|
||||||
<option value="whoogle">Whoogle</option>
|
<option value="whoogle">Whoogle</option>
|
||||||
<option value="startpage">Startpage</option>
|
<option value="startpage">Startpage</option>
|
||||||
<option value="ecosia">Ecosia</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div id="searx-whoogle">
|
<div id="searx-whoogle">
|
||||||
|
|
|
@ -34,7 +34,7 @@ function changeFrontendsSettings(frontend) {
|
||||||
whoogleDivElement.style.display = 'block';
|
whoogleDivElement.style.display = 'block';
|
||||||
SearxWhoogleElement.style.display = 'block';
|
SearxWhoogleElement.style.display = 'block';
|
||||||
}
|
}
|
||||||
else if (frontend == 'startpage' || frontend == 'ecosia') {
|
else if (frontend == 'startpage') {
|
||||||
frontendElement.innerHTML = `Frontend: <span style="color:red;">This is a centralized service</span>`;
|
frontendElement.innerHTML = `Frontend: <span style="color:red;">This is a centralized service</span>`;
|
||||||
searxDivElement.style.display = 'none';
|
searxDivElement.style.display = 'none';
|
||||||
searxngDivElement.style.display = 'none';
|
searxngDivElement.style.display = 'none';
|
||||||
|
|
Loading…
Reference in New Issue