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