diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-04-07 20:27:38 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-04-08 07:53:04 +0200 |
commit | 4acb52f68f5a40408b8331686111658a1030de0b (patch) | |
tree | f57abe93935448c110efc60fd703c23d0f8b5eec | |
parent | b6fe2cad719e80a3a9c3700a46ad2a5d7342f1b4 (diff) | |
download | searxng-4acb52f68f5a40408b8331686111658a1030de0b.tar.gz searxng-4acb52f68f5a40408b8331686111658a1030de0b.zip |
[fix] even if limiter not activated, botdetection must be activated
Closes: #2975
Closes: #2995
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r-- | searx/limiter.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/searx/limiter.py b/searx/limiter.py index 08326b42e..93070dac5 100644 --- a/searx/limiter.py +++ b/searx/limiter.py @@ -218,10 +218,16 @@ def initialize(app: flask.Flask, settings): """Install the limiter""" global _INSTALLED # pylint: disable=global-statement + # even if the limiter is not activated, the botdetection must be activated + # (e.g. the self_info plugin uses the botdetection to get client IP) + + cfg = get_cfg() + redis_client = redisdb.client() + botdetection.init(cfg, redis_client) + if not (settings['server']['limiter'] or settings['server']['public_instance']): return - redis_client = redisdb.client() if not redis_client: logger.error( "The limiter requires Redis, please consult the documentation: " @@ -233,10 +239,8 @@ def initialize(app: flask.Flask, settings): _INSTALLED = True - cfg = get_cfg() if settings['server']['public_instance']: # overwrite limiter.toml setting cfg.set('botdetection.ip_limit.link_token', True) - botdetection.init(cfg, redis_client) app.before_request(pre_request) |