searxng/searx/templates/simple
Markus Heiser e0a3dee3bf [POC] limiter: change PING of link_token mehtod from CSS to <img>
while PR #2357 [1] was being implemented the question came up:

    would be better to change the PING resource from CSS to an image so that
    some terminal based browser may still able to pass the test [1]

This patch implements a POC in where a <img src=token> tag is loaded instaed a
CSS.

To test this patch activate limiter and link_token method [3] and start a
developer instance::

    make run

In your terminal browser open http://127.0.0.1:8888/search?q=foo

If the browser is suitable for the link_token method, it loads the image and the
following messages appear::

    DEBUG   searx.botdetection.limiter    : OK 127.0.0.1/32: /clientft61aak7fzyu6o6v.svg ...
    DEBUG   searx.botdetection.link_token : token is valid --> True
    DEBUG   searx.botdetection.link_token : store ping_key for (client) network 127.0.0.1/32 (IP 127.0.0.1) -> SearXNG_limiter.ping[...]

Browsers that do not load images will be blocked: If you try by example::

    lynx http://127.0.0.1:8888/search?q=foo

you will see a WARNING message like::

    WARNING searx.botdetection.link_token : missing ping (IP: 127.0.0.1/32) / request: SearXNG_limiter.ping[...]

----

[1] 80aaef6c95
[2] https://github.com/searxng/searxng/pull/2357#issuecomment-1574898834
[3] activate limiter and link_token method

```diff
diff --git a/searx/botdetection/limiter.toml b/searx/botdetection/limiter.toml
index 71a231e8f..7e1dba755 100644
--- a/searx/botdetection/limiter.toml
+++ b/searx/botdetection/limiter.toml
@@ -17,6 +17,6 @@ ipv6_prefix = 48
 filter_link_local = false

 # acrivate link_token method in the ip_limit method
-link_token = false
+link_token = true

diff --git a/searx/settings.yml b/searx/settings.yml
index a82a3432d..e7b983afc 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -73,7 +73,7 @@ server:
   # public URL of the instance, to ensure correct inbound links. Is overwritten
   # by ${SEARXNG_URL}.
   base_url: false  # "http://example.com/location"
-  limiter: false  # rate limit the number of request on the instance, block some bots
+  limiter: true  # rate limit the number of request on the instance, block some bots

   # If your instance owns a /etc/searxng/settings.yml file, then set the following
   # values there.
```

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-03 18:49:21 +02:00
..
elements [fix] simple theme: move engine alerts in case of no results into sidebar 2023-05-28 12:19:32 +02:00
filters [mod] replace searx.languages by searx.sxng_locales 2023-03-24 10:37:42 +01:00
messages [fix] simple theme: move engine alerts in case of no results into sidebar 2023-05-28 12:19:32 +02:00
preferences [fix] URL percent-encoding in translations fail in babel 2023-06-02 20:30:41 +02:00
result_templates [mod] paper.html: simplify template by using result_link macro 2022-09-24 16:13:36 +02:00
404.html Drop Python 2 (2/n): templates 2020-09-10 10:39:04 +02:00
base.html [POC] limiter: change PING of link_token mehtod from CSS to <img> 2023-06-03 18:49:21 +02:00
categories.html [fix] don't show a category if there is no active engine in 2023-04-10 09:22:21 +02:00
icons.html [build] /static 2022-07-02 10:05:43 +02:00
index.html Workaround: index.html: remove image preload 2022-06-18 09:04:13 +02:00
info.html Theme: add Help and Donate links in all pages 2022-06-25 20:31:40 +02:00
macros.html [mod] template preferences: split into elements (no functional change) 2023-06-02 19:05:43 +02:00
new_issue.html [mod] allow brand.issue_url to overwrite the step1 url 2022-07-10 18:43:53 +02:00
opensearch.xml [fix] improve OpenSearch description 2022-08-11 19:04:36 +02:00
opensearch_response_rss.xml theme: remove __common__ 2022-05-07 19:40:48 +02:00
page_with_header.html [mod] template preferences: split into elements (no functional change) 2023-06-02 19:05:43 +02:00
preferences.html [mod] template preferences: split into elements (no functional change) 2023-06-02 19:05:43 +02:00
results.html [fix] simple theme: move engine alerts in case of no results into sidebar 2023-05-28 12:19:32 +02:00
search.html [simple theme] set tab index for search page input field #1891 2023-01-08 13:41:48 +03:00
searxng-wordmark.min.svg theme: remove __common__ 2022-05-07 19:40:48 +02:00
simple_search.html Merge pull request #1004 from MontyQI/search_url 2022-03-26 17:08:50 +01:00
stats.html Stats: display only the score per result, no anymore the score 2022-09-02 08:30:38 +00:00