mirror of https://github.com/searxng/searxng.git
e0a3dee3bf
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]
|
||
---|---|---|
.. | ||
answerers | ||
botdetection | ||
data | ||
enginelib | ||
engines | ||
infopage | ||
metrics | ||
network | ||
plugins | ||
search | ||
static | ||
templates/simple | ||
tools | ||
translations | ||
__init__.py | ||
autocomplete.py | ||
babel_extract.py | ||
compat.py | ||
exceptions.py | ||
external_bang.py | ||
external_urls.py | ||
flaskfix.py | ||
locales.py | ||
preferences.py | ||
query.py | ||
redisdb.py | ||
redislib.py | ||
results.py | ||
searxng.msg | ||
settings.yml | ||
settings_defaults.py | ||
settings_loader.py | ||
sxng_locales.py | ||
unixthreadname.py | ||
utils.py | ||
version.py | ||
webadapter.py | ||
webapp.py | ||
webutils.py |