diff options
| author | Bnyro <bnyro@tutanota.com> | 2024-05-15 16:30:49 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-06-07 14:42:52 +0200 |
| commit | f5eb56b63f250c7804e5e1cf4426e550bc933906 (patch) | |
| tree | c0267c726de3be65676d48d7e97dce052a789259 /searx/plugins/hostname_replace.py | |
| parent | 845a0b678d0c94a68d0ec333aeaa7f7e6b7a18e8 (diff) | |
[refactor] hostnames plugin: add fallback for old hostname_replace plugin
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins/hostname_replace.py')
| -rw-r--r-- | searx/plugins/hostname_replace.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/searx/plugins/hostname_replace.py b/searx/plugins/hostname_replace.py new file mode 100644 index 000000000..48900a3f9 --- /dev/null +++ b/searx/plugins/hostname_replace.py @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring + +from flask_babel import gettext +from searx.plugins import logger + +name = gettext('Hostname replace') +description = "Deprecated / contact system admin to configure 'Hostnames plugin'!!" +default_on = False +preference_section = 'general' + +plugin_id = 'hostname_replace' +logger = logger.getChild(plugin_id) + +REPORTED = False + + +def deprecated_msg(): + global REPORTED # pylint: disable=global-statement + if REPORTED: + return + logger.error( + "'Hostname replace' plugin is deprecated and will be dropped soon!" + " Configure 'Hostnames plugin':" + " https://docs.searxng.org/src/searx.plugins.hostnames.html" + ) + REPORTED = True + + +def on_result(_request, _search, result): + # pylint: disable=import-outside-toplevel, cyclic-import + from searx.plugins.hostnames import on_result as hostnames_on_result + + deprecated_msg() + return hostnames_on_result(_request, _search, result) |