remove_nonprivacy_options.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. diff --git a/js/searchbar/bangsPlugin.js b/js/searchbar/bangsPlugin.js
  2. index 176c3c8f5..016c11229 100644
  3. --- a/js/searchbar/bangsPlugin.js
  4. +++ b/js/searchbar/bangsPlugin.js
  5. @@ -105,7 +105,18 @@ function showBangSearchResults (results, input, event, container) {
  6. function getBangSearchResults (text, input, event, container) {
  7. // get results from DuckDuckGo if it is a search engine, and the current tab is not a private tab
  8. - if (currentSearchEngine.name === 'DuckDuckGo' && !tabs.get(tabs.getSelected()).private) {
  9. + if (currentSearchEngine.name === 'DuckDuckGo HTML' && !tabs.get(tabs.getSelected()).private) {
  10. + fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), {
  11. + cache: 'force-cache'
  12. + })
  13. + .then(function (response) {
  14. + return response.json()
  15. + })
  16. + .then(function (results) {
  17. + // show the DuckDuckGo results, combined with the custom !bangs
  18. + showBangSearchResults(results.concat(searchCustomBangs(text)), input, event, container)
  19. + })
  20. + } else if (currentSearchEngine.name === 'DuckDuckGo Lite' && !tabs.get(tabs.getSelected()).private) {
  21. fetch('https://ac.duckduckgo.com/ac/?t=min&q=' + encodeURIComponent(text), {
  22. cache: 'force-cache'
  23. })
  24. diff --git a/js/searchbar/instantAnswerPlugin.js b/js/searchbar/instantAnswerPlugin.js
  25. index 22ab0da84..ea385692d 100644
  26. --- a/js/searchbar/instantAnswerPlugin.js
  27. +++ b/js/searchbar/instantAnswerPlugin.js
  28. @@ -1,6 +1,8 @@
  29. function showSearchbarInstantAnswers (text, input, event, container) {
  30. // only make requests to the DDG api if DDG is set as the search engine
  31. - if (currentSearchEngine.name !== 'DuckDuckGo') {
  32. + if (currentSearchEngine.name !== 'DuckDuckGo HTML') {
  33. + return
  34. + } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') {
  35. return
  36. }
  37. diff --git a/js/searchbar/searchSuggestionsPlugin.js b/js/searchbar/searchSuggestionsPlugin.js
  38. index 7c3dc5e91..fcd2d544c 100644
  39. --- a/js/searchbar/searchSuggestionsPlugin.js
  40. +++ b/js/searchbar/searchSuggestionsPlugin.js
  41. @@ -2,7 +2,9 @@ var ddgAttribution = 'Results from DuckDuckGo'
  42. function showSearchSuggestions (text, input, event, container) {
  43. // TODO support search suggestions for other search engines
  44. - if (currentSearchEngine.name !== 'DuckDuckGo') {
  45. + if (currentSearchEngine.name !== 'DuckDuckGo HTML') {
  46. + return
  47. + } else if (currentSearchEngine.name !== 'DuckDuckGo Lite') {
  48. return
  49. }
  50. diff --git a/js/util/searchEngine.js b/js/util/searchEngine.js
  51. index 18ff46e20..1c41b7ec8 100644
  52. --- a/js/util/searchEngine.js
  53. +++ b/js/util/searchEngine.js
  54. @@ -3,28 +3,20 @@ var currentSearchEngine = {
  55. searchURL: '%s'
  56. }
  57. -var defaultSearchEngine = 'DuckDuckGo'
  58. +var defaultSearchEngine = 'DuckDuckGoHTML'
  59. var searchEngines = {
  60. - DuckDuckGo: {
  61. - name: 'DuckDuckGo',
  62. - searchURL: 'https://duckduckgo.com/?q=%s&t=min'
  63. + DuckDuckGoHTML: {
  64. + name: 'DuckDuckGo HTML',
  65. + searchURL: 'https://duckduckgo.com/html/?q=%s&t=min'
  66. },
  67. - Google: {
  68. - name: 'Google',
  69. - searchURL: 'https://google.com/search?q=%s'
  70. + DuckDuckGoLite: {
  71. + name: 'DuckDuckGo Lite',
  72. + searchURL: 'https://duckduckgo.com/lite/?q=%s&t=min'
  73. },
  74. - Bing: {
  75. - name: 'Bing',
  76. - searchURL: 'https://www.bing.com/search?q=%s'
  77. - },
  78. - Yahoo: {
  79. - name: 'Yahoo',
  80. - searchURL: 'https://search.yahoo.com/yhs/search?p=%s'
  81. - },
  82. - Baidu: {
  83. - name: 'Baidu',
  84. - searchURL: 'https://www.baidu.com/s?wd=%s'
  85. + searx: {
  86. + name: 'searx',
  87. + searchURL: 'https://searx.laquadrature.net/search?q=%s'
  88. },
  89. StartPage: {
  90. name: 'StartPage',
  91. @@ -34,10 +26,6 @@ var searchEngines = {
  92. name: 'Wikipedia',
  93. searchURL: 'https://wikipedia.org/w/index.php?search=%s'
  94. },
  95. - Yandex: {
  96. - name: 'Yandex',
  97. - searchURL: 'https://yandex.com/search/?text=%s'
  98. - },
  99. none: {
  100. name: 'none',
  101. searchURL: 'http://%s'