From fb49b332629f19371191bc469d5293343a883a1e Mon Sep 17 00:00:00 2001 From: Akhil Date: Thu, 5 Oct 2023 13:52:45 +0530 Subject: [PATCH 1/8] Activate link_token from limiter.toml --- searx/botdetection/limiter.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/botdetection/limiter.toml b/searx/botdetection/limiter.toml index 9560ec8f6..6b8f0772d 100644 --- a/searx/botdetection/limiter.toml +++ b/searx/botdetection/limiter.toml @@ -17,7 +17,7 @@ ipv6_prefix = 48 filter_link_local = false # activate link_token method in the ip_limit method -link_token = false +link_token = true [botdetection.ip_lists] @@ -37,4 +37,4 @@ pass_ip = [ # Activate passlist of (hardcoded) IPs from the SearXNG organization, # e.g. `check.searx.space`. -pass_searxng_org = true \ No newline at end of file +pass_searxng_org = true -- GitLab From efe055d27c94652d17f82c9f15915944065acd18 Mon Sep 17 00:00:00 2001 From: Akhil Date: Thu, 5 Oct 2023 19:29:16 +0530 Subject: [PATCH 2/8] Page not found for page > 5 --- searx/webapp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/searx/webapp.py b/searx/webapp.py index a300559a7..421289bf5 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -696,6 +696,8 @@ def search(): search_query, raw_text_query, _, _, selected_locale = get_search_query_from_webapp( request.preferences, request.form ) + if (search_query.pageno > 5): + return index_error(output_format, "Page not found"), 404 search = SearchWithPlugins(search_query, request.user_plugins, request) # pylint: disable=redefined-outer-name result_container = search.search() -- GitLab From f283e14ce7e74040d2237aa4bad963029fcf6336 Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 6 Oct 2023 12:53:50 +0530 Subject: [PATCH 3/8] Apply suggestions --- searx/botdetection/limiter.toml | 2 +- searx/webapp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/botdetection/limiter.toml b/searx/botdetection/limiter.toml index 6b8f0772d..3be8d1602 100644 --- a/searx/botdetection/limiter.toml +++ b/searx/botdetection/limiter.toml @@ -17,7 +17,7 @@ ipv6_prefix = 48 filter_link_local = false # activate link_token method in the ip_limit method -link_token = true +link_token = false [botdetection.ip_lists] diff --git a/searx/webapp.py b/searx/webapp.py index 421289bf5..f31769009 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -697,7 +697,7 @@ def search(): request.preferences, request.form ) if (search_query.pageno > 5): - return index_error(output_format, "Page not found"), 404 + return index_error(output_format, gettext("Page not found")), 404 search = SearchWithPlugins(search_query, request.user_plugins, request) # pylint: disable=redefined-outer-name result_container = search.search() -- GitLab From b205a25f4b754c29e7932c306a84ffec6e3b1544 Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 6 Oct 2023 13:01:40 +0530 Subject: [PATCH 4/8] Lint fix --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/webapp.py b/searx/webapp.py index f31769009..e9754a821 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -696,7 +696,7 @@ def search(): search_query, raw_text_query, _, _, selected_locale = get_search_query_from_webapp( request.preferences, request.form ) - if (search_query.pageno > 5): + if search_query.pageno > 5: return index_error(output_format, gettext("Page not found")), 404 search = SearchWithPlugins(search_query, request.user_plugins, request) # pylint: disable=redefined-outer-name result_container = search.search() -- GitLab From 3321734a20999fbe9dbe42b9f08e418a3b33ebe3 Mon Sep 17 00:00:00 2001 From: Florent VINCENT Date: Mon, 9 Oct 2023 10:02:31 +0000 Subject: [PATCH 5/8] Update etheme.js to add a custom header to async GETs as temporary workaround to bots. --- searx/static/themes/etheme/js/etheme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/static/themes/etheme/js/etheme.js b/searx/static/themes/etheme/js/etheme.js index 3d665a954..1992cb8d6 100644 --- a/searx/static/themes/etheme/js/etheme.js +++ b/searx/static/themes/etheme/js/etheme.js @@ -144,7 +144,7 @@ $(document).ready(function(){ }); if ($("#main_results").has(".first-page-media-results").length) { - var headers = {"headers": { "Content-Type": "application/json"}}; + var headers = {"headers": { "Content-Type": "application/json","X-e-async":"true"}}; var query_params = $.param({ "format": "json", "q": $("#q").attr("value"), -- GitLab From 21f9b404055e0ee18e2a65e413604c45a80d7b82 Mon Sep 17 00:00:00 2001 From: Florent VINCENT Date: Mon, 9 Oct 2023 12:29:08 +0000 Subject: [PATCH 6/8] Update etheme.js to add a custom header to async GETs as temporary workaround to bots. --- searx/static/themes/etheme/js/etheme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/static/themes/etheme/js/etheme.js b/searx/static/themes/etheme/js/etheme.js index 6b80b6e35..3c11b8c17 100644 --- a/searx/static/themes/etheme/js/etheme.js +++ b/searx/static/themes/etheme/js/etheme.js @@ -144,7 +144,7 @@ $(document).ready(function(){ }); if ($("#main_results").has(".first-page-media-results").length) { - var headers = {"Content-Type": "application/json"}; + var headers = {"Content-Type": "application/json","X-e-async":"true"}; var query_params = $.param({ "format": "json", "q": $("#q").attr("value"), -- GitLab From b42e2204a0762b80d61c736b84b8964589529984 Mon Sep 17 00:00:00 2001 From: Florent VINCENT Date: Mon, 9 Oct 2023 12:59:09 +0000 Subject: [PATCH 7/8] Update etheme.min.js to integrate the X-e-async change in the minified version --- searx/static/themes/etheme/js/etheme.min.js | Bin 3806 -> 3816 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/searx/static/themes/etheme/js/etheme.min.js b/searx/static/themes/etheme/js/etheme.min.js index 7f4fbe55121ee4cf3efb44fca267dbc0ea437b5e..9a67a63de3b9044893a5dacc0e5a424606c5c728 100644 GIT binary patch delta 38 tcmca7`$BeuEYD;$9z|gtr3l?r-NfR`yksRSrIMo3RHe-xJkyvMxd83%3t#{M delta 27 icmaDMdrx+QEDuLUYGO)iQL)uz86G9Z+RcGH)0hB>{RsO2 -- GitLab From d2d61f3d5d7b701fb3c692ed0f91bae576029389 Mon Sep 17 00:00:00 2001 From: Akhil Date: Tue, 10 Oct 2023 14:41:30 +0530 Subject: [PATCH 8/8] Remove pageno check --- searx/webapp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/searx/webapp.py b/searx/webapp.py index e9754a821..a300559a7 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -696,8 +696,6 @@ def search(): search_query, raw_text_query, _, _, selected_locale = get_search_query_from_webapp( request.preferences, request.form ) - if search_query.pageno > 5: - return index_error(output_format, gettext("Page not found")), 404 search = SearchWithPlugins(search_query, request.user_plugins, request) # pylint: disable=redefined-outer-name result_container = search.search() -- GitLab