summaryrefslogtreecommitdiff
path: root/searx/preferences.py
AgeCommit message (Collapse)Author
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-09[black] upgrade black 22.12.0 --> 24.2.0Markus Heiser
The issue discussed in [1] has been solved since [2] has been merged into black / now we can upgrade without touching 69 files as it was needed with black 23.1.0 [3]. [1] https://github.com/searxng/searxng/pull/2159#issuecomment-1425723977 [2] https://github.com/psf/black/pull/4060 [3] https://github.com/searxng/searxng/pull/2159/files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-10-09[mod] add hotkeys option to settings.ymlAlex Balgavy
The change in the hotkey mechanism introduced in 317db5b04 does not allow configuration via `settings.yml`. This commit adds that functionality. Closes: #2898
2023-09-19[mod] preferences: implement drop-down menu for hotkeys (default, vim)Markus Heiser
Replace the on/off checkbox of the vim-hotkeys in the preferences by a drop-down menu. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-09-18[feat] search on category select without JSBnyro
Co-authored-by: Alexandre Flament <alex@al-f.net>
2023-08-27[mod] preferences.py: add and use BooleanSetting for checkbox preferencesBnyro
2023-08-27[feat] settings: replace boolean select preferences with checkboxesBnyro
2023-05-22[fix] ClientPref - don't raise exception if Accept-Language is invalidMarkus Heiser
If the Accept-Language header [1] is set but empty or holds a value that is unknown to babel, an excpetion is raised:: $ curl --header 'Accept-Language: xyz' 'http://127.0.0.1:8888/search?q=foo' ... Traceback (most recent call last): File "searx/preferences.py", line 335, in from_http_request return cls(locale=pairs[0][0]) IndexError: list index out of range [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language Reported by: @Eolien55 in https://github.com/searxng/searxng/issues/2434#issuecomment-1556199789 Closes: https://github.com/searxng/searxng/issues/2434 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-15[mod] add a Preferences.client property to store client prefsMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-07[mod] clarify the difference of the default category and subgroupingMarkus Heiser
This PR does no functional change it is just an attempt to make more clear in the code, what a default category is and what a subcategory is. The previous name 'others' leads to confusion with the **category 'other'**. If a engine is not assigned to a category, the default is assigned:: DEFAULT_CATEGORY = 'other' If an engine has only one category and this category is shown as tab in the user interface, this engine has no further subgrouping:: NO_SUBGROUPING = 'without further subgrouping' Related: - https://github.com/searxng/searxng/issues/1604 - https://github.com/searxng/searxng/pull/1545 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-02-17Add "Auto-detected" as a language.Alexandre Flament
When the user choose "Auto-detected", the choice remains on the following queries. The detected language is displayed. For example "Auto-detected (en)": * the next query language is going to be auto detected * for the current query, the detected language is English. This replace the autodetect_search_language plugin.
2022-11-24Deserialize explicitly blank stringsfehho
Default behavior of urllib.parse_qs is to discard blank values, causing a preference of none to be deserialized as undefined, using the instance default rather than the selected preference.
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-03[fix] typo: add missing 'n' in center_aligment --> center_alignmentMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-06-18Theme: add a preference to center the results (Oscar) (2nd edition)Alexandre Flament
related to * #1169 * #1281 * #1286
2022-06-05Revert "Theme: add a preference to center the results (Oscar)"Alexandre Flament
This reverts commit 4237f5fd50c2dc0e91513056d885f25038ef6787.
2022-06-05Merge pull request #1281 from dalf/style-centerAlexandre Flament
Theme: add a preference to center the results
2022-06-05Theme: add a preference to center the results (Oscar)Alexandre Flament
related to #1169
2022-06-03[fix] prepare for pylint 2.14.0Markus Heiser
Remove issue reported by Pylint 2.14.0: - no-self-use: has been moved to optional extension [1] - The refactoring checker now also raises 'consider-using-generator' messages for max(), min() and sum(). [2] .pylintrc: - <option name>-hint has been removed since long, Pylint 2.14.0 raises an error on invalid options - bad-continuation and bad-whitespace have been removed [3] [1] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/full.html#what-s-new-in-pylint-2-14-0 [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.6/summary.html#summary-release-highlights 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-02-20[mod] infinite_scroll as preferenceAlexandre Flament
* oscar theme: code from searx/plugins/infinite_scroll.py * simple theme: new implementation Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
2022-01-13[fix] make BooleanChoices only set cookies that vary from the defaultMartin Fischer
The bug was inadvertently introduced by the refactor in 180d4d068b4c629ab99876b55046f98455b88149. Fixes #746.
2022-01-06[refactor] refactor SwitchableSettingMartin Fischer
The previous implementation used two hash sets and a list. ... that's not necessary ... a single hash map suffices. And it's also less error prone ... because the previous data structure allowed a setting to be enabled and disabled at the same time.
2022-01-06[refactor] stop SwitchableSetting from subclassing SettingMartin Fischer
Previously the default_value was abused for the cookie name. Having SwitchableSetting subclass Setting doesn't even make sense in the first place since none of the Setting methods apply.
2022-01-06[refactor] remove pointless tupleMartin Fischer
2022-01-06[refactor] add type hints & remove Setting._post_initMartin Fischer
Previously the Setting classes used a horrible _post_init hack that prevented proper type checking.
2022-01-05[enh] change categories_as_tabs from a list to a dictMartin Fischer
The tab icon names are currently hard coded in the templates. This commit lets us introduce an icon property in the future, e.g: categories_as_tabs: general: icon: search-outline
2022-01-05[fix] stop setting superfluous cookies for "non tab categories"Martin Fischer
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>
2021-12-27[format.python] disable py code formatting for some hunks of codeMarkus Heiser
Disable the python code formatting from python-black, where the readability of code suffers by formatting. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-11-24Merge pull request #485 from dalf/pref_query_in_titleAlexandre Flament
[mod] new preference: query_in_title
2021-11-19[enh] simple theme: add "simple-style" preferencesAlexandre Flament
2021-11-08[mod] new preference: query_in_titleAlexandre Flament
* disable by default * settings.yml: ui.query_in_title * in /preferences: privacy tab when enabled, the result page's title contains the user query. previously: * oscar theme: the query was always included * simple theme: the query was included with the GET method
2021-10-26[enh] reduce the available language listAlexandre Flament
close #406 settings['search']['languages'] contains the languages codes and 'all'
2021-09-07[pylint] searx: drop no longer needed 'missing-function-docstring'Markus Heiser
Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914168470 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-31[pylint] Pylint 2.10 - fix use-list-literal & use-dict-literalMarkus Heiser
Pylint 2.10 added new default checks [1]: use-list-literal Emitted when list() is called with no arguments instead of using [] use-dict-literal Emitted when dict() is called with no arguments instead of using {} [1] https://pylint.pycqa.org/en/latest/whatsnew/2.10.html Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-08-03[mod] settings.yml: remove localesAlexandre Flament
There are detected from the searx/translations directory
2021-07-03[pylint] prepare for pylint v2.9.3 / fix some (new) pylint issuesMarkus Heiser
Upgrade from pylint v2.8.3 to 2.9.3 raise some new issues:: searx/search/checker/__main__.py:37:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) searx/search/checker/__main__.py:38:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) searx/search/processors/__init__.py:20:0: R0402: Use 'from searx import engines' instead (consider-using-from-import) searx/preferences.py:182:19: C0207: Use data.split('-', maxsplit=1)[0] instead (use-maxsplit-arg) searx/preferences.py:506:15: R1733: Unnecessary dictionary index lookup, use 'user_setting' instead (unnecessary-dict-index-lookup) searx/webapp.py:436:0: C0206: Consider iterating with .items() (consider-using-dict-items) searx/webapp.py:950:4: C0206: Consider iterating with .items() (consider-using-dict-items) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-06-26[fix] decoding of saved preferences in the URLMarkus Heiser
To compress saved preferences in the URL was introduced in 5f758b2d3 and slightly fixed in 8f4401462. But the main fail was not fixed; The decompress function returns a binary string and this binary should first be decoded to a string before it is passed to urllib.parse_qs. BTW: revert the hot-fix from 5973491 Related-to: https://github.com/searxng/searxng/issues/166 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-06-01[mod] move all default settings into searx.settings_defaultsAlexandre Flament
2021-04-26[pylint] tag PYLINT_FILES by comment `# lint: pylint`Markus Heiser
These py files are linted by `test.pylint`, all other files are linted by `test.pep8`. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-04-04[fix] default_doi_resolver in preferencesMarkus Heiser
Instead of a hard-coded `oadoi.org` default, use the default value from `settings.yml`. Fix an issue in the themes: The replacement 'current_doi_resolver' contains the doi_resolver_url, not the name of the DOI resolver. Compare return value of:: searx.plugins.oa_doi_rewrite.get_doi_resolver(...) Fix a typo in `get_doi_resolver(..)`: suggested by @kvch: *L32 should set doi_resolver not doi_resolvers* Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-11-23Patch advanced search preferencesrenyhp
2020-11-22Add preference for displaying advanced settingsrenyhp
2020-10-25Let admins lock user preferencesNoémi Ványi
2020-10-01[mod] preferences.py: check language setting with a regex instead of ↵Alexandre Flament
match_language
2020-09-10Drop Python 2 (3/n): objectsDalf
2020-09-10Drop Python 2 (1/n): remove unicode string and url_utilsDalf
2020-09-01Add key to settings.yml for opening result links in a new tabScott Wallace
Closes #1552 Closes #444