In its previous implementation, the macro ``checkbox_onoff_reversed`` always
created an ``aria-labelledby`` attribute, even if there was no descriptive tag
with the generated ID (used as the value of the ``aria-labelledby``).
Before this patch, the Nu-HTML-Checker [1] reported 255 issues of this type::
The aria-labelledby attribute must point to an element in the same document. (255)
[1] https://validator.w3.org/nu/
Signed-off-by: Markus <markus@venom.fritz.box>
The ``aria-labelledby`` [1] attribute identifies the element that labels the
element it is applied to. The templates ``infinite_scroll.html`` and
``search_on_category_select.html`` define a ``aria-labelledby`` at the <input>
tag but miss the id in the <div> with the description.
[1] https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby
Signed-off-by: Markus <markus@venom.fritz.box>
So far a CAPTCHA was not recognized in the response of the qwant engine and a
SearxEngineAPIException was raised by mistake. With this patch a CAPTCHA
redirect is recognized and the correct SearxEngineCaptchaException is raised.
Closes: https://github.com/searxng/searxng/issues/3806
Signed-off-by: Markus <markus@venom.fritz.box>
This patch fixes a bug reported by CI "Fetch traits" [1] (brave) and improves
other fetch traits functions (google, annas_archive & radio_browser).
brave:
File "/home/runner/work/searxng/searxng/searx/engines/brave.py", line 434, in fetch_traits
sxng_tag = region_tag(babel.Locale.parse(ui_lang, sep='-'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/searxng/searxng/searx/locales.py", line 155, in region_tag
Error: raise ValueError('%s missed a territory')
google:
change ERROR message about unknow UI language to INFO message
radio_browser:
country_list contains duplicates that differ only in upper/lower case
annas_archive:
for better diff; sort the persistence of the traits
[1] https://github.com/searxng/searxng/actions/runs/10606312371/job/29433352518#step:6:41
Signed-off-by: Markus <markus@venom.fritz.box>
* [feat] engine: add right dao
* [enh] right dao engine: allow additional classes
Allow additional classes while parsing to prevent the engine from breaking in the future if additional classes are added to the elements.
Co-authored-by: Bnyro <bnyro@tutanota.com>
---------
Co-authored-by: Bnyro <bnyro@tutanota.com>
The user_agent attribute of the Flask request object is an instance of
the werkzeug.user_agent.UserAgent class.
This will fix the following error of the self_info plugin:
> ERROR:searx.plugins.self_info: Exception while calling post_search
> Traceback (most recent call last):
> File "searx/plugins/__init__.py", line 203, in call
> ret = getattr(plugin, plugin_type)(*args, **kwargs)
> File "searx/plugins/self_info.py", line 31, in post_search
> search.result_container.answers['user-agent'] = {'answer': gettext('Your user-agent is: ') + ua}
> TypeError: can only concatenate str (not "UserAgent") to str
We do not want to show the user-agent information from the duckduckgo
zero click info. This is the user-agent used by searxng and not the
user-agent used by the user.
This was already done for the IP address in:
0fb3f0e4ae
Changes made to tineye engine:
1. Importing logging if TYPE_CHECKING is enabled
2. Remove unecessary try-catch around json parsing the response, as this
masked the original error and had no immediate benefit
3. Improve error handling explicitely for status code 422 and 400
upfront, deferring json_parsing only for these status codes and
successful status codes
4. Unit test all new applicable changes to ensure compatability
You have to copy and paste the query without using the keyboard to replicate the
issue. As soon as you press the keyboard the cross appears. [1]
- [1] https://github.com/searxng/searxng/issues/3725#issuecomment-2282655272
Reported-by: @Immortality-IMT in [1]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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 f5eb56b63f.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Google underlines words inside of answers that can be clicked to show
additional definitions. These definitions inside the answer were not
correctly handled and ended up in the middle of the answer text. With
this fix, the extra definitions are stripped from the answer shown by
the frontend.
Fault pattern: if there are no offers, then an exception has been thrown:
IndexError: list index out of range
This patch makes the addition of “best price” dependent on whether one exists.
Closes: #3685
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
In my review of [1] I tried to reformat the template code of the language
menue whereby I have made two mistakes.
- default language was added twice
- in the 'Auto-detect' item a hard coded `[auto]` was implemented where the
`search_language` variable was needed.
[1] https://github.com/searxng/searxng/issues/3645
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
A recent update from Mullvad Leta introduced the img_elem. This update
broke the existing logic. Now, by checking the length of the dom_result
to see if it was included in the return results, we can handle the logic
accordingly.
The intention of this PR is to modernize the settings_loader implementations.
The concept is old (remember, this is partly from 2014), back then we only had
one config file, meanwhile we have had a folder with config files for a very
long time. Callers can now load a YAML configuration from this folder as
follows ::
settings_loader.get_yaml_cfg('my-config.yml')
- BTW this is a fix of #3557.
- Further the `existing_filename_or_none` construct dates back to times when
there was not yet a `pathlib.Path` in all Python versions we supported in the
past.
- Typehints have been added wherever appropriate
At the same time, this patch should also be downward compatible and not
introduce a new environment variable. The localization of the folder with the
configurations is further based on:
SEARXNG_SETTINGS_PATH (wich defaults to /etc/searxng/settings.yml)
Which means, the default config folder is `/etc/searxng/`.
ATTENTION: intended functional changes!
If SEARXNG_SETTINGS_PATH was set and pointed to a not existing file, the
previous implementation silently loaded the default configuration. This
behavior has been changed: if the file or folder does not exist, an
EnvironmentError exception will be thrown in future.
Closes: https://github.com/searxng/searxng/issues/3557
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
If the flag icon is first, it prevents easily searching the select list on the
keyboard. By moving the icon fully to the right, this will enable a user to
search the select list.
Closes: https://github.com/searxng/searxng/issues/3645
The domains of zlibrary instances are known to be seized from time to time.
This leads to problems when, for example, the automated tasks try to update the
engine traits (aka fetch_traits). The search function should also generate a
suitable error message (currently either SSL errors or empty result lists are
returned). [1]
[1] https://github.com/searxng/searxng/issues/3610
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Fix installing answerers when installing SearXNG through a wheel [1]. These
files have been missed in commit d72fa99b.
Here is what have been tested:
$ make clean py.build
...
$ python -m venv test123
$ . ./test123/bin/activate
(test123) $ pip install dist/searxng-2024*-py3-none-any.whl
(test123) $ SEARXNG_DEBUG=1 searxng-run
[1] https://github.com/searxng/searxng/pull/3045#issuecomment-1961767861
This change does the following things:
- the `ip` keyword is now case-insensitive
- if the query includes `my ip` it will now also match
In order to avoid too many false matches, the `ip` keyword alone matches only if
it's the _only_ word, but the inclusion of `my` loosens that to be inclusive of
users type a phrase (eg, "what is my ip", "tell me my ip", "my IP address",
etc).
Better answer context
Previously this plugin simply dumped your IP or user-agent string as an answer.
This tiny change just adds some text to contextualize those answers (eg, "Your
IP is: 1.2.3.4" instead of just "1.2.3.4").