diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2019-02-08 23:01:04 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2019-02-08 23:01:04 +0100 |
commit | 04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e (patch) | |
tree | 9bbf1919272207780662c82a4dd4fda85302a106 /nonfree/min/remove_nonprivacy_options.patch | |
parent | 63a2fd1c33db9410d56321f76182f6e92cedf216 (diff) | |
download | abslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.tar.gz abslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.tar.bz2 abslibre-04fc41a7d944dcc5b7b7be265aa4982ea5a4db2e.zip |
libre/min: moved to nonfree (depends on electron)
Diffstat (limited to 'nonfree/min/remove_nonprivacy_options.patch')
-rw-r--r-- | nonfree/min/remove_nonprivacy_options.patch | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/nonfree/min/remove_nonprivacy_options.patch b/nonfree/min/remove_nonprivacy_options.patch new file mode 100644 index 000000000..76aedd419 --- /dev/null +++ b/nonfree/min/remove_nonprivacy_options.patch @@ -0,0 +1,107 @@ +diff --git a/js/searchbar/bangsPlugin.js b/js/searchbar/bangsPlugin.js +index 176c3c8f5..016c11229 100644 +--- a/js/searchbar/bangsPlugin.js ++++ b/js/searchbar/bangsPlugin.js +@@ -105,7 +105,18 @@ function showBangSearchResults (results, input, event, container) { + function getBangSearchResults (text, input, event, container) { + + // get results from DuckDuckGo if it is a search engine, and the current tab is not a private tab +- if (currentSearchEngine.name === 'DuckDuckGo' && !tabs.get(tabs.getSelected()).private) { ++ if (currentSearchEngine.name === 'DuckDuckGo HTML' && !tabs.get(tabs.getSelected()).private) { ++ fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), { ++ cache: 'force-cache' ++ }) ++ .then(function (response) { ++ return response.json() ++ }) ++ .then(function (results) { ++ // show the DuckDuckGo results, combined with the custom !bangs ++ showBangSearchResults(results.concat(searchCustomBangs(text)), input, event, container) ++ }) ++ } else if (currentSearchEngine.name === 'DuckDuckGo Lite' && !tabs.get(tabs.getSelected()).private) { + fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), { + cache: 'force-cache' + }) +diff --git a/js/searchbar/instantAnswerPlugin.js b/js/searchbar/instantAnswerPlugin.js +index 22ab0da84..ea385692d 100644 +--- a/js/searchbar/instantAnswerPlugin.js ++++ b/js/searchbar/instantAnswerPlugin.js +@@ -1,6 +1,8 @@ + function showSearchbarInstantAnswers (text, input, event, container) { + // only make requests to the DDG api if DDG is set as the search engine +- if (currentSearchEngine.name !== 'DuckDuckGo') { ++ if (currentSearchEngine.name !== 'DuckDuckGo HTML') { ++ return ++ } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') { + return + } + +diff --git a/js/searchbar/searchSuggestionsPlugin.js b/js/searchbar/searchSuggestionsPlugin.js +index 7c3dc5e91..fcd2d544c 100644 +--- a/js/searchbar/searchSuggestionsPlugin.js ++++ b/js/searchbar/searchSuggestionsPlugin.js +@@ -2,7 +2,9 @@ var ddgAttribution = 'Results from DuckDuckGo' + + function showSearchSuggestions (text, input, event, container) { + // TODO support search suggestions for other search engines +- if (currentSearchEngine.name !== 'DuckDuckGo') { ++ if (currentSearchEngine.name !== 'DuckDuckGo HTML') { ++ return ++ } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') { + return + } + +diff --git a/js/util/searchEngine.js b/js/util/searchEngine.js +index 18ff46e20..1c41b7ec8 100644 +--- a/js/util/searchEngine.js ++++ b/js/util/searchEngine.js +@@ -3,28 +3,20 @@ var currentSearchEngine = { + searchURL: '%s' + } + +-var defaultSearchEngine = 'DuckDuckGo' ++var defaultSearchEngine = 'DuckDuckGoHTML' + + var searchEngines = { +- DuckDuckGo: { +- name: 'DuckDuckGo', +- searchURL: 'https://duckduckgo.com/?q=%s&t=min' ++ DuckDuckGoHTML: { ++ name: 'DuckDuckGo HTML', ++ searchURL: 'https://duckduckgo.com/html/?q=%s&t=min' + }, +- Google: { +- name: 'Google', +- searchURL: 'https://google.com/search?q=%s' ++ DuckDuckGoLite: { ++ name: 'DuckDuckGo Lite', ++ searchURL: 'https://duckduckgo.com/lite/?q=%s&t=min' + }, +- Bing: { +- name: 'Bing', +- searchURL: 'https://www.bing.com/search?q=%s' +- }, +- Yahoo: { +- name: 'Yahoo', +- searchURL: 'https://search.yahoo.com/yhs/search?p=%s' +- }, +- Baidu: { +- name: 'Baidu', +- searchURL: 'https://www.baidu.com/s?wd=%s' ++ searx: { ++ name: 'searx', ++ searchURL: 'https://searx.laquadrature.net/search?q=%s' + }, + StartPage: { + name: 'StartPage', +@@ -34,10 +26,6 @@ var searchEngines = { + name: 'Wikipedia', + searchURL: 'https://wikipedia.org/w/index.php?search=%s' + }, +- Yandex: { +- name: 'Yandex', +- searchURL: 'https://yandex.com/search/?text=%s' +- }, + none: { + name: 'none', + searchURL: 'http://%s' |