diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-06-07 15:38:09 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-08-08 11:58:32 +0200 |
commit | dcf95644c6ba7308f521ca14dbed79127404af7f (patch) | |
tree | 940891fe01257b49d1f61284e9b5bc41e428e04f /searx/plugins/hostnames.py | |
parent | 0cfed94b08ad6c767dceab89b36a62fc9785a534 (diff) | |
download | searxng-dcf95644c6ba7308f521ca14dbed79127404af7f.tar.gz searxng-dcf95644c6ba7308f521ca14dbed79127404af7f.zip |
[breaking change] drop deprecated hostname_replace plugin
The successor is “hostname plugin” from PR:
- https://github.com/searxng/searxng/pull/3463
---
Revert "[refactor] hostnames plugin: add fallback for old hostname_replace plugin"
This reverts commit f5eb56b63f250c7804e5e1cf4426e550bc933906.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins/hostnames.py')
-rw-r--r-- | searx/plugins/hostnames.py | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/searx/plugins/hostnames.py b/searx/plugins/hostnames.py index 2783f23eb..770b00e15 100644 --- a/searx/plugins/hostnames.py +++ b/searx/plugins/hostnames.py @@ -3,16 +3,6 @@ """In addition to rewriting/replace reslut URLs, the *hoostnames* plugin offers other features. -.. attention:: - - The 'Hostnames plugin' from `PR-3463 - <https://github.com/searxng/searxng/pull/3463>`_ is a rewrite of the - 'Hostname replace' plugin. Backwards compatibility is guaranteed for a - transitional period, but this will end soon. - - **To maintainers of SearXNG instances, please modify your old plugin config - to the new.** - - ``hostnames.replace``: A **mapping** of regular expressions to hostnames to be replaced by other hostnames. @@ -129,29 +119,8 @@ def _load_regular_expressions(settings_key): return {} -# compatibility fallback for old hostname replace plugin -# TODO: remove in the future once most/all instance maintainers finished migrating # pylint: disable=fixme -def _load_regular_expressions_with_fallback(settings_key): - expressions = _load_regular_expressions(settings_key) - if expressions: - return expressions - - # fallback to the old `hostname_replace` settings format - # pylint: disable=import-outside-toplevel, cyclic-import - hostname_replace_config = settings.get('hostname_replace', {}) - if hostname_replace_config: - from searx.plugins.hostname_replace import deprecated_msg - - deprecated_msg() - - if settings_key == 'replace': - return {re.compile(p): r for (p, r) in hostname_replace_config.items() if r} - - return {re.compile(p) for (p, r) in hostname_replace_config.items() if not r} - - -replacements = _load_regular_expressions_with_fallback('replace') -removables = _load_regular_expressions_with_fallback('remove') +replacements = _load_regular_expressions('replace') +removables = _load_regular_expressions('remove') high_priority = _load_regular_expressions('high_priority') low_priority = _load_regular_expressions('low_priority') |