summaryrefslogtreecommitdiff
path: root/searxng_extra
AgeCommit message (Collapse)Author
2024-05-01[fix] update wikidata units - remove URL prefix from Q-nameMarkus Heiser
Sometimes the URL prefix switches from a http to a https, this patch harden the code that removes the URL prefix from wikidata Q-name, issue has been reported in [1]. [1] https://github.com/searxng/searxng/pull/3437#issuecomment-2082121730 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-04-27[feat] plugins: new unit converter pluginBnyro
2024-03-11[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTIONMarkus Heiser
In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-10[mod] comprehensive revision of the searxng_extra/update/ scriptsMarkus Heiser
- pylint all scripts - fix some errors reported by pyright - from searx.data import data_dir (Path.open) - fix import from pygments.formatters.html NOTE: none functional changes! Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-10[fix] update_external_bangs: BANGS_URL 'https://duckduckgo.com/bang.js'Markus Heiser
JSON file which contains the bangs / there is no longer a versioning of this file. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-03-09[fix] issues reported by pylint 3.1.0Markus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-02-20[fix] sort RTL_LOCALES before written into locales.jsonMarkus Heiser
To avoid unnecessary changes to the file, the list should be sorted before it is written to the file. You can test it by calling multiple times:: make data.locales and searx/data/locales.json should be unchanged. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-02-20[mod] reduce memory footprint by not calling babel.Locale.parse at runtimeAlexandre Flament
babel.Locale.parse loads more than 60MB in RAM. The only purpose is to get: LOCALE_NAMES - searx.data.LOCALES["LOCALE_NAMES"] RTL_LOCALES - searx.data.LOCALES["RTL_LOCALES"] This commit calls babel.Locale.parse when the translations are update from weblate and stored in:: searx/data/locales.json This file can be build by:: ./manage data.locales By store these variables in searx.data when the translations are updated we save round about 65MB (usually 4 worker = 260MB of RAM saved. Suggested-by: https://github.com/searxng/searxng/discussions/2633#discussioncomment-8490494 Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
2024-01-29Update searx.data - update_engine_traits.pydalf
2023-12-23Revert "[fix] update user agent"Markus Heiser
This reverts commit 3c6549a17f886b90a8e700810f9e1aea86581966. Related: - https://github.com/searxng/searxng/pull/2826
2023-09-25[fix] update user agentjazzzooo
2023-09-18[fix] spellingjazzzooo
2023-09-11[feature] dark theme for code highlighter in the result listMarkus Heiser
Closes: https://github.com/searxng/searxng/issues/1354 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-08-09[fix] make flask_babel.gettext() work in engine modules (L10n & threads)Markus Heiser
incident: flask_babel.gettext() does not work in the engine modules. cause: the request() and response() functions of the engine modules run in the processor, whose search() method runs in a thread and in the threads the context of the Flask app does not exist. The context of the Flask app is needed by the gettext() function for the L10n. Solution: copy context of the Flask app into the threads. [1] special case: We cannot equip the search() method of the processors with the decorator [1], because the decorator requires a context (Flask app) that does not yet exist at the time of the initialization of the processors (the initialization of the processors is part of the initialization of the Flask app). [1] https://flask.palletsprojects.com/en/2.3.x/api/#flask.copy_current_request_context Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-28[fix] update_currencies.py - AttributeError: 'str' object has no attribute ↵Markus Heiser
'insert' Replace lists with one item by the item, not before last currency has been added. In this traceback 'MXN' is added to 'pesos' while pesos is no longer a list as the optimization was carried out too early. $ ./local/py3/bin/python searxng_extra/update/update_currencies.py Traceback (most recent call last): File "searxng_extra/update/update_currencies.py", line 164, in <module> main() File "searxng_extra/update/update_currencies.py", line 157, in main add_currency_name(db, "pesos", 'MXN') File "searxng_extra/update/update_currencies.py", line 89, in add_currency_name iso4217_set.insert(0, iso4217) AttributeError: 'str' object has no attribute 'insert' Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-19[mod] move some code from webapp module to webutils module (no functional ↵Markus Heiser
change) Over the years the webapp module became more and more a mess. To improve the modulaization a little this patch moves some implementations from the webapp module to webutils module. HINT: this patch brings non functional change Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-16[fix] Israeli flag emoji in locale dropdownMarc Abonce Seguin
🇮🇱 https://emojipedia.org/flag-israel/
2023-04-15[fix] searxng_extra/update/update_engine_descriptions.py (part 2)Alexandre FLAMENT
Wikipedia description are fetched without the help the wikipedia engine: * the SQPARL query return the wikipedia URL of the article
2023-04-15[fix] searxng_extra/update/update_engine_descriptions.py (part 1)Markus Heiser
Follow up of #2269 The script to update the descriptions of the engines does no longer work since PR #2269 has been merged. searx/engines/wikipedia.py ========================== 1. There was a misusage of zh-classical.wikipedia.org: - `zh-classical` is dedicate to classical Chinese [1] which is not traditional Chinese [2]. - zh.wikipedia.org has LanguageConverter enabled [3] and is going to dynamically show simplified or traditional Chinese according to the HTTP Accept-Language header. 2. The update_engine_descriptions.py needs a list of all wikipedias. The implementation from #2269 included only a reduced list: - https://meta.wikimedia.org/wiki/Wikipedia_article_depth - https://meta.wikimedia.org/wiki/List_of_Wikipedias searxng_extra/update/update_engine_descriptions.py ================================================== Before PR #2269 there was a match_language() function that did an approximation using various methods. With PR #2269 there are only the types in the data model of the languages, which can be recognized by babel. The approximation methods, which are needed (only here) in the determination of the descriptions, must be replaced by other methods. [1] https://en.wikipedia.org/wiki/Classical_Chinese [2] https://en.wikipedia.org/wiki/Traditional_Chinese_characters [3] https://www.mediawiki.org/wiki/Writing_systems#LanguageConverter Closes: https://github.com/searxng/searxng/issues/2330 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] replace utils.match_language by locales.match_localeMarkus Heiser
This patch replaces the *full of magic* ``utils.match_language`` function by a ``locales.match_locale``. The ``locales.match_locale`` function is based on the ``locales.build_engine_locales`` introduced in 9ae409a0 [1]. In the past SearXNG did only support a search by a language but not in a region. This has been changed a long time ago and regions have been added to SearXNG core but not to the engines. The ``utils.match_language`` was the function to handle the different aspects of language/regions in SearXNG core and the supported *languages* in the engine. The ``utils.match_language`` did it with some magic and works good for most use cases but fails in some edge case. To replace the concurrence of languages and regions in the SearXNG core the ``locales.build_engine_locales`` was introduced in 9ae409a0 [1]. With the last patches all engines has been migrated to a ``fetch_traits`` and a language/region concept that is based on ``locales.build_engine_locales``. To summarize: there is no longer a need for the ``locales.match_language``. [1] https://github.com/searxng/searxng/pull/1652 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] replace searx.languages by searx.sxng_localesMarkus Heiser
With the language and region tags from the EngineTraitsMap the handling of SearXNG's tags of languages and regions has been normalized and is no longer a *mystery*. The "languages" became "locales" that are supported by babel and by this, the update_engine_traits.py can be simplified a lot. Other code places can be simplified as well, but these simplifications should (respectively can) only be done when none of the engines work with the deprecated EngineTraits.supported_languages interface anymore. This commit replaces searx.languages by searx.sxng_locales and fix the naming of some names from "language" to "locale" (e.g. language_codes --> sxng_locales). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] replace engines_languages.json by engines_traits.jsonMarkus Heiser
Implementations of the *traits* of the engines. Engine's traits are fetched from the origin engine and stored in a JSON file in the *data folder*. Most often traits are languages and region codes and their mapping from SearXNG's representation to the representation in the origin search engine. To load traits from the persistence:: searx.enginelib.traits.EngineTraitsMap.from_data() For new traits new properties can be added to the class:: searx.enginelib.traits.EngineTraits .. hint:: Implementation is downward compatible to the deprecated *supported_languages method* from the vintage implementation. The vintage code is tagged as *deprecated* an can be removed when all engines has been ported to the *traits method*. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-02[fix] make docs: NameError: name 'DOC' is not definedMarkus Heiser
To reproduce the issue set base_url:: diff --git a/searx/settings.yml b/searx/settings.yml index 841457b5e..4e282cb61 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -72,7 +72,7 @@ server: bind_address: "127.0.0.1" # public URL of the instance, to ensure correct inbound links. Is overwritten # by ${SEARXNG_URL}. - base_url: false # "http://example.com/location" + base_url: "http://example.com/location" limiter: false # rate limit the number of request on the instance, block some bots and build the docs:: $ make docs SPHINX HTML ./docs --> file:///800GBPCIex4/share/SearXNG/dist/docs DOCS build build/docs/includes Traceback (most recent call last): File "searxng_extra/docs_prebuild", line 85, in <module> sys.exit(main()) File "searxng_extra/docs_prebuild", line 31, in main f.write(page.content) File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__ next(self.gen) File "searxng_extra/docs_prebuild", line 81, in _instance_infosetset_ctx return DOC NameError: name 'DOC' is not defined Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-02-10[fix] remove usage of deprecated-module distutisMarkus Heiser
Closes: https://github.com/searxng/searxng/issues/2168 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-02-10[mod] make python code pylint 2.16.1 compliantMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-12-16Replace langdetect with fasttextArtikusHG
2022-11-05User agent: don't include the patch number in the Firefox versionAlexandre Flament
The Firefox version in the user agent doesn't include the patch version: 106.0 not 106.0.2 Close #1914
2022-10-11[fix] update_osm_keys_tags.py: sort JSON dumpMarkus Heiser
To get meaningful diff, the keys in JSON dump needs to be sorted. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-27[fix] typos / reported by @kianmeng in searx PR-3366Markus Heiser
[PR-3366] https://github.com/searx/searx/pull/3366 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-07-02fix searxng_extra/update/update*.py scriptsAlexandre Flament
call searx.locales.locales_initialize before using LOCALE_NAMES Related to https://github.com/searxng/searxng/pull/1306
2022-06-14[doc] fix some leftovers from ad964562cMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-30[theme] peel out oscar from SearXNG developmentMarkus Heiser
This is the first step of removing oscar theme Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-22[fix] add back missing languages & regions (followup of PR #1071)Markus Heiser
In PR #1071 the language catalog of dailymotion has been cleaned up, before there had been over 7000 "languages" in the catalog. As a side effect of this clean-up the language & region catalog in SearXNG has been reduced [1]. This patch reduce the ``min_engines_per_lang`` from 13 to 12 to get the missed languages back in language & region catalog of SearXNG. [1] https://github.com/searxng/searxng/pull/1071/commits/3bb62823ec3af0e67bd2d959bec20c4791ee3bac#diff-f3f00db0f87f95b882624a192e0aac21525638af0b18c9514e765fcf1991678d Requested-by: @tiekoetter in a Matrix chat Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-05[fix] add missing territory (country) nameMarkus Heiser
Related-to: https://github.com/searxng/searxng/pull/1029#issuecomment-1086824911 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-28Merge pull request #967 from return42/language-filterAlexandre Flament
[mod] add flags to the languages filter
2022-03-25[fix] pylint issue in py3.10Markus Heiser
searxng_extra/update/update_firefox_version.py:16:0: W0402: Uses of a deprecated module 'distutils.version' (deprecated-module) [1] https://github.com/searxng/searxng/pull/1007 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19[fix] languages: show country name even if there is only one countryMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19[fix] don't show flags for languages without region identifierMarkus Heiser
SearXNG shows two different things: region: "de-CH" is the equivalent of "Schweiz (de)" in DDG. languages: "en" doesn't say anything about the location. It is up the engines to do their best to select English results without a region. Suggested-by: @dalf https://github.com/searxng/searxng/pull/967#issuecomment-1072979693 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19[mod] add flags to the languages filterMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-16Info: code refactoring & bug fixesAlexandre Flament
2022-03-13Various change on PR 930Alexandre Flament
2022-03-12[mod] replace /help by /info pages and include pages in project docsMarkus Heiser
This patch implements a bolierplate to share content from info-pages of the SearXNG instance (URL /info) with the project documentation (path /docs/user). The info pages are using Markdown (CommonMark), to include them in the project documentation (reST) the myst-parser [1] is used in the Sphinx-doc build chain. If base_url is known (defined in settings.yml) links to the instance are also inserted into the project documentation:: searxng_extra/docs_prebuild [1] https://www.sphinx-doc.org/en/master/usage/markdown.html Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-02-20[mod] switch default theme from oscar to simpleMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-12[fix] external bangs: don't overwrite Bangs in data trieMarkus Heiser
Bangs with a `*` suffix (e.g. `!!d*`) overwrite Bangs with the same prefix (e.g. `!!d`) [1]. This can be avoid when a non printable character is used to tag a LEAF_KEY. [1] https://github.com/searxng/searxng/pull/740#issuecomment-1010411888 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-05[pylint] add scripts from searxng_extra/update to pylintMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-05[docs] add documentation for the scripts in searxng_extra/updateMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-03[docs] move searxng_extra/ stuff to the developer section.Markus Heiser
Stuff in folder searxng_extra/ is not suitable for normal users and should only be used by developers. The script searxng_extra/standalone_searx.py must not give the impression that it improves privacy. [1] [1] https://github.com/searxng/searxng/pull/651#issuecomment-1001389726 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-01[fix] update_languages.py: generate code that passes CIMarkus Heiser
File searx/languages.py, created by update_languages.py has to pass quality check from CI:: make format.python Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-01[fix] update_languages.py: no excption on unknown locale & languageMarkus Heiser
Fix exception handling of unknown locales and languages:: ERROR: ca_ES_valencia --> [Errno 2] No such file or directory: 'local/py3/lib/python3.8/site-packages/babel/locale-data/ca_ES_valencia.dat' ERROR: languages['fil-PH'] --> {'name': None, 'english_name': None} ERROR: languages['nb-NO'] --> {'name': None, 'english_name': None} Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-12-27[format.python] initial formatting of the python codeMarkus Heiser
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>