The error message in case the vqd value could not be determined was incorrect
and triggered an exception::
File "/usr/local/searxng/searxng-src/searx/engines/duckduckgo.py", line 132, in get_vqd
logger.error("vqd value from duckduckgo.com ", resp.status_code)
Message: 'vqd value from duckduckgo.com '
Arguments: (202,)
If the ``on_result`` handle returns False, then the ``else`` was always jumped
to, which throws the NotImplementedError exception::
File "/usr/local/searxng/searxng-src/searx/results.py", line 99, in extend
raise NotImplementedError(f"no handler implemented to process the result of type {result}")
NotImplementedError: no handler implemented to process the result of type MainResult(title=...
Pyright has been installed twice so far, once via `package.json` and once in the
test script via `npx --no-install`. Separating the type checks in the CI and on
the developer desktop is also not necessary.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Implement rules and functions to format shell scripts:
$ make format.shell
or alternatively to format all source code:
$ make format
The formatter `shfmt` reads the rules from the editorconfig[1]
If any EditorConfig files are found, they will be used to apply formatting
options. If any parser or printer flags are given to the tool, no
EditorConfig files will be used.
[1] https://github.com/patrickvane/shfmt?tab=readme-ov-file#description
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The `go.mod` was created by::
$ ./manage dev.env
(dev.env)$ go mod init searxng.org/devtools
(dev.env)$ go get -tool mvdan.cc/sh/v3/cmd/shfmt@v3.12.0
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The current google_videos.py in the master branch is completely non functional, due to it not parsing the returned video search results correctly. The result is searxng saying that no results were found. This commit is a new updated google_videos.py that's designed to fix that and is confirmed to be working.
Implementing the suggestions by Bnyro.
Re-formatted with `black` for compatibility. After failing automated checks, ran the command:
black --line-length 120 --skip-string-normalization --target-version py311 google_videos.py
The path to static should be relative (If sxng is served under "/sxng", the static route passed to the client won't be "/sxng/static/..." as expected but "/static/...")
Closes https://github.com/searxng/searxng/issues/5042
Wordnik is now an answerer and not in the infobox anymore: it uses the
translations answerer, because it provides all the features needed. By default,
only its first results is shown
Additionally a new "define" category is added - I know, it's the same as the
"dictionaries" category, but I don't think we can alias categories. This allows
to search e.g. for `!define tree`, the idea is to allow easy searches for
definitions of words.
Related:
- https://github.com/searxng/searxng/issues/4111
While looking at ways to better handle static files, I saw a package that replaces Flask `static_folder` functionality. Not only it's considerably faster, but already includes the capability to serve sidecars without having to intercept. This also replaces the uWSGI folder mapping functionality.
Closes https://github.com/searxng/searxng/issues/4977
I've seen that by default Granian sets a `Cache-Control` header for 1 day IF `GRANIAN_STATIC_PATH_MOUNT` is set. This option is not a hard requirement, but it's set because I found to be faster when serving the static files.
Another thing is that by removing `GRANIAN_STATIC_PATH_MOUNT`, the headers set by the application are present again in the static files, which was not the case before.
Related https://github.com/searxng/searxng/pull/5004
Whether the query is a real calculation tasks is currently only detected in the
AST, resulting in unnecessary creatins of subprocesses. This problem is
mitigated with this patch: if the query contains letters, it is obviously not a
math problem, and the plugin can return without further action.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
In customizing it should be decided which plugin modules should be loaded and
which should not.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
These engines override the user agent manually using `gen_useragent`, although that's already done in the online preprocessor that runs before the actual `request(query, params)` method is called. Hence, this call is duplicated.
Related:
- https://github.com/searxng/searxng/pull/4990#discussion_r2195142838
- apparently, PDIA switched from Angolia to AWS :/
- we no longer require an API key, but the AWS node might change, so we still have to extract the API url of the node
- the response format is still the same, so no changes needed in that regard
- closes#4989
Depending on the respective runtime behavior, it could happen that the initial
loading of the DB tables in the cache was performed multiple times and in
parallel. The concurrent accesses then led to the `sqlite3.OperationalError:
database is locked` exception as in #4951.
Since this problem depends significantly on the runtimes (e.g., how long it
takes to retrieve the content for a table), this error could not be observed in
all installations.
Closes: https://github.com/searxng/searxng/issues/4951
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This patch migrates from `redis==5.2.1` [1] to `valkey==6.1.0` [2].
The migration to valkey is necessary because the company behind Redis has decided
to abandon the open source license. After experiencing a drop in user numbers,
they now want to run it under a dual license again. But this move demonstrates
once again how unreliable the company is and how it treats open source
developers.
To review first, read the docs::
$ make docs.live
Follow the instructions to remove redis:
- http://0.0.0.0:8000/admin/settings/settings_redis.html
Config and install a local valkey DB:
- http://0.0.0.0:8000/admin/settings/settings_valkey.html
[1] https://pypi.org/project/redis/
[2] https://pypi.org/project/valkey/
Co-authored-by: HLFH <gaspard@dhautefeuille.eu>
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
The issue was introduced in commit: edfbf1e
Problematic code::
def timeout_func(timeout, func, *args, **kwargs):
...
if not p.is_alive():
ret_val = que.get()
else:
logger.debug("terminate function after timeout is exceeded") # type: ignore
p.terminate()
p.join()
p.close()
The `logger` function in the `else` path is not defined. Was accidentally
removed in commit edfbf1e without providing an appropriate replacement.::
File "/usr/local/searxng/searx/plugins/calculator.py", line 216, in timeout_func
logger.debug("terminate function after timeout is exceeded") # type: ignore
^^^^^^
NameError: name 'logger' is not defined
The exception triggered by this prevents the `p.terminate()` from being
executed. As a result, the processes accumulate in memory (memory leak).
Related: https://github.com/searxng/searx-instances/discussions/708#discussioncomment-13688168
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Integration / Python 3.10 (push) Has been cancelled
Integration / Python 3.11 (push) Has been cancelled
Integration / Python 3.12 (push) Has been cancelled
Integration / Python 3.13 (push) Has been cancelled
Integration / Python 3.9 (push) Has been cancelled
Integration / Theme (push) Has been cancelled
What's changed?
- this PR adds Pixabay, a collection of royalty free images
- additionaly it seems to have some videos, so there's an engine for it too
Author Notes
- when using SearXNG's transport, all our requests will get blocked, probably due to fingerprinting
- we should find an alternative solution because this is just a hacky change to make things work for now, but idk how ...
It's possible that `SyntaxError` or `TypeError` instances are thrown
when we can't evaluate a query, simply because it's not a math expression.
In this case, it should just be skipped, i.e. the calculator plugin doesn't
return any result instead of forwarding the exception.