From 649a8dd577b7db5549a34af6f667daf1b61ffb6b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 26 Jul 2025 06:22:46 +0200 Subject: [PATCH] [fix] cleanup: rename `searx` leftovers to `SearXNG` (#5049) Signed-off-by: Markus Heiser --- AUTHORS.rst | 2 +- docs/admin/api.rst | 2 +- docs/admin/installation.rst | 4 ++-- docs/admin/settings/settings_ui.rst | 2 +- searx/engines/base.py | 4 ++-- searx/engines/elasticsearch.py | 2 +- searx/engines/photon.py | 6 +++--- searx/engines/stract.py | 4 ++-- searx/engines/torznab.py | 2 +- searx/engines/wikidata.py | 4 ++-- searx/exceptions.py | 2 +- searx/search/checker/__main__.py | 2 +- searx/settings.yml | 2 +- searx/translations/messages.pot | 6 +++--- searx/utils.py | 8 +++----- searxng_extra/update/update_engine_descriptions.py | 4 ++-- tests/unit/settings/user_settings.yml | 2 +- tests/unit/test_utils.py | 8 ++++---- utils/lib_sxng_weblate.sh | 2 +- 19 files changed, 33 insertions(+), 35 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index ca475a429..ef0800bb0 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,7 +2,7 @@ searxng is a fork from `searx `_ and is maintained by Markus Heiser (`@return42 `_) People who have submitted patches/translations, reported bugs, consulted -features or generally made searx better: +features or generally made SearXNG better: - Adam Tauber `@asciimoo `_ - Matej Cotman `@matejc `_ diff --git a/docs/admin/api.rst b/docs/admin/api.rst index 8bd563ba7..7445c7b3b 100644 --- a/docs/admin/api.rst +++ b/docs/admin/api.rst @@ -59,7 +59,7 @@ Sample response "shortcut": "bb" }, ], - "instance_name": "searx", + "instance_name": "SearXNG", "locales": { "de": "Deutsch (German)", "en": "English", diff --git a/docs/admin/installation.rst b/docs/admin/installation.rst index da603a639..cd5b854b3 100644 --- a/docs/admin/installation.rst +++ b/docs/admin/installation.rst @@ -18,5 +18,5 @@ special preferences, it's recommended to use the :ref:`installation container` o .. attention:: SearXNG is growing rapidly, you should regularly read our :ref:`migrate and - stay tuned` section. If you want to upgrade an existing instance or migrate - from searx to SearXNG, you should read this section first! + stay tuned` section. If you want to upgrade an existing instance, you + should read this section first! diff --git a/docs/admin/settings/settings_ui.rst b/docs/admin/settings/settings_ui.rst index 222e0f2c5..cbb134267 100644 --- a/docs/admin/settings/settings_ui.rst +++ b/docs/admin/settings/settings_ui.rst @@ -25,7 +25,7 @@ ``default_locale`` : SearXNG interface language. If blank, the locale is detected by using the browser language. If it doesn't work, or you are deploying a language - specific instance of searx, a locale can be defined using an ISO language + specific instance of SearXNG, a locale can be defined using an ISO language code, like ``fr``, ``en``, ``de``. ``query_in_title`` : diff --git a/searx/engines/base.py b/searx/engines/base.py index 4f99d6717..328a1fc07 100755 --- a/searx/engines/base.py +++ b/searx/engines/base.py @@ -7,7 +7,7 @@ import re from urllib.parse import urlencode from lxml import etree -from searx.utils import searx_useragent +from searx.utils import searxng_useragent # about about = { @@ -69,7 +69,7 @@ def request(query, params): params['url'] = base_url.format(**string_args) - params['headers']['User-Agent'] = searx_useragent() + params['headers']['User-Agent'] = searxng_useragent() return params diff --git a/searx/engines/elasticsearch.py b/searx/engines/elasticsearch.py index c4992b02f..c613ae367 100644 --- a/searx/engines/elasticsearch.py +++ b/searx/engines/elasticsearch.py @@ -101,7 +101,7 @@ def request(query, params): def _match_query(query): """ The standard for full text queries. - searx format: "key:value" e.g. city:berlin + SearXNG format: "key:value" e.g. city:berlin REF: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html """ diff --git a/searx/engines/photon.py b/searx/engines/photon.py index 43c41bf46..07fcfdf31 100644 --- a/searx/engines/photon.py +++ b/searx/engines/photon.py @@ -5,7 +5,7 @@ from json import loads from urllib.parse import urlencode -from searx.utils import searx_useragent +from searx.utils import searxng_useragent # about about = { @@ -40,8 +40,8 @@ def request(query, params): if language in supported_languages: params['url'] = params['url'] + "&lang=" + language - # using searx User-Agent - params['headers']['User-Agent'] = searx_useragent() + # using SearXNG User-Agent + params['headers']['User-Agent'] = searxng_useragent() return params diff --git a/searx/engines/stract.py b/searx/engines/stract.py index ffd475732..feeae05b1 100644 --- a/searx/engines/stract.py +++ b/searx/engines/stract.py @@ -6,7 +6,7 @@ ends. """ from json import dumps -from searx.utils import searx_useragent +from searx.utils import searxng_useragent from searx.enginelib.traits import EngineTraits about = { @@ -31,7 +31,7 @@ def request(query, params): params['headers'] = { 'Accept': 'application/json', 'Content-Type': 'application/json', - 'User-Agent': searx_useragent(), + 'User-Agent': searxng_useragent(), } region = traits.get_region(params["searxng_locale"], default=traits.all_locale) params['data'] = dumps( diff --git a/searx/engines/torznab.py b/searx/engines/torznab.py index cfe7e2b4f..333a21812 100644 --- a/searx/engines/torznab.py +++ b/searx/engines/torznab.py @@ -149,7 +149,7 @@ def build_result(item: etree.Element) -> Dict[str, Any]: leechers = get_torznab_attribute(item, 'leechers') peers = get_torznab_attribute(item, 'peers') - # map attributes to searx result + # map attributes to SearXNG result result: Dict[str, Any] = { 'template': 'torrent.html', 'title': get_attribute(item, 'title'), diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index 5b5764d20..167364d4e 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -15,7 +15,7 @@ from babel.dates import format_datetime, format_date, format_time, get_datetime_ from searx.data import WIKIDATA_UNITS from searx.network import post, get -from searx.utils import searx_useragent, get_string_replaces_function +from searx.utils import searxng_useragent, get_string_replaces_function from searx.external_urls import get_external_url, get_earth_coordinates_url, area_to_osm_zoom from searx.engines.wikipedia import ( fetch_wikimedia_traits, @@ -142,7 +142,7 @@ replace_http_by_https = get_string_replaces_function({'http:': 'https:'}) def get_headers(): # user agent: https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits - return {'Accept': 'application/sparql-results+json', 'User-Agent': searx_useragent()} + return {'Accept': 'application/sparql-results+json', 'User-Agent': searxng_useragent()} def get_label_for_entity(entity_id, language): diff --git a/searx/exceptions.py b/searx/exceptions.py index 3d720467f..17eca28b0 100644 --- a/searx/exceptions.py +++ b/searx/exceptions.py @@ -97,7 +97,7 @@ class SearxEngineCaptchaException(SearxEngineAccessDeniedException): class SearxEngineTooManyRequestsException(SearxEngineAccessDeniedException): """The website has returned a Too Many Request status code - By default, searx stops sending requests to this engine for 1 hour. + By default, SearXNG stops sending requests to this engine for 1 hour. """ SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineTooManyRequests" diff --git a/searx/search/checker/__main__.py b/searx/search/checker/__main__.py index 984c8526c..183a51bf2 100644 --- a/searx/search/checker/__main__.py +++ b/searx/search/checker/__main__.py @@ -94,7 +94,7 @@ def run(engine_name_list, verbose): # call by setup.py def main(): - parser = argparse.ArgumentParser(description='Check searx engines.') + parser = argparse.ArgumentParser(description='Check SearXNG engines.') parser.add_argument( 'engine_name_list', metavar='engine name', diff --git a/searx/settings.yml b/searx/settings.yml index 38c087689..fd6684264 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -175,7 +175,7 @@ outgoing: request_timeout: 3.0 # the maximum timeout in seconds # max_request_timeout: 10.0 - # suffix of searx_useragent, could contain information like an email address + # suffix of searxng_useragent, could contain information like an email address # to the administrator useragent_suffix: "" # The maximum number of concurrent connections that may be established. diff --git a/searx/translations/messages.pot b/searx/translations/messages.pot index 78e84a8c0..00071ffa6 100644 --- a/searx/translations/messages.pot +++ b/searx/translations/messages.pot @@ -1,12 +1,12 @@ -# Translations template for PROJECT. +# Translations template for SearXNG. # Copyright (C) 2025 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. +# This file is distributed under the same license as the SearXNG project. # FIRST AUTHOR , 2025. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" +"Project-Id-Version: SearXNG -\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2025-07-03 14:46+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/searx/utils.py b/searx/utils.py index 7b7cd8f5d..54b32484e 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -61,11 +61,9 @@ class _NotSetClass: # pylint: disable=too-few-public-methods _NOTSET = _NotSetClass() -def searx_useragent() -> str: - """Return the searx User Agent""" - return 'searx/{searx_version} {suffix}'.format( - searx_version=VERSION_TAG, suffix=settings['outgoing']['useragent_suffix'] - ).strip() +def searxng_useragent() -> str: + """Return the SearXNG User Agent""" + return f"SearXNG/{VERSION_TAG} {settings['outgoing']['useragent_suffix']}".strip() def gen_useragent(os_string: Optional[str] = None) -> str: diff --git a/searxng_extra/update/update_engine_descriptions.py b/searxng_extra/update/update_engine_descriptions.py index 916e18802..769af128a 100755 --- a/searxng_extra/update/update_engine_descriptions.py +++ b/searxng_extra/update/update_engine_descriptions.py @@ -16,7 +16,7 @@ from os.path import join from lxml.html import fromstring from searx.engines import wikidata, set_loggers -from searx.utils import extract_text, searx_useragent +from searx.utils import extract_text, searxng_useragent from searx.locales import LOCALE_NAMES, locales_initialize, match_locale from searx import searx_dir from searx.utils import gen_useragent, detect_language @@ -113,7 +113,7 @@ def get_wikipedia_summary(wikipedia_url, searxng_locale): # get the REST API URL from the HTML URL # Headers - headers = {'User-Agent': searx_useragent()} + headers = {'User-Agent': searxng_useragent()} if searxng_locale in WIKIPEDIA_LANGUAGE_VARIANTS: headers['Accept-Language'] = WIKIPEDIA_LANGUAGE_VARIANTS.get(searxng_locale) diff --git a/tests/unit/settings/user_settings.yml b/tests/unit/settings/user_settings.yml index fc80173f6..39c4d9c07 100644 --- a/tests/unit/settings/user_settings.yml +++ b/tests/unit/settings/user_settings.yml @@ -1,6 +1,6 @@ general: debug: false - instance_name: "searx" + instance_name: "SearXNG" search: safe_search: 0 diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 55352914b..ad6ca37a5 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -23,10 +23,10 @@ class TestUtils(SearxTestCase): self.assertIsNotNone(utils.gen_useragent()) self.assertTrue(utils.gen_useragent().startswith('Mozilla')) - def test_searx_useragent(self): - self.assertIsInstance(utils.searx_useragent(), str) - self.assertIsNotNone(utils.searx_useragent()) - self.assertTrue(utils.searx_useragent().startswith('searx')) + def test_searxng_useragent(self): + self.assertIsInstance(utils.searxng_useragent(), str) + self.assertIsNotNone(utils.searxng_useragent()) + self.assertTrue(utils.searxng_useragent().startswith('SearXNG')) def test_html_to_text(self): html_str = """ diff --git a/utils/lib_sxng_weblate.sh b/utils/lib_sxng_weblate.sh index 3486fa0eb..546d2636e 100755 --- a/utils/lib_sxng_weblate.sh +++ b/utils/lib_sxng_weblate.sh @@ -142,7 +142,7 @@ weblate.push.translations() { # update messages.pot in the master branch build_msg BABEL 'extract messages from source files and generate POT file' - pybabel extract -F babel.cfg \ + pybabel extract -F babel.cfg --project="SearXNG" --version="-" \ -o "${messages_pot}" \ "searx/"