Commit Graph

6083 Commits

Author SHA1 Message Date
Martin Fischer 640c404844 [pyright:strict] searx.search.checker.background 2022-01-27 22:07:12 +01:00
Martin Fischer 8aef66b365 [enh] use typing_extensions for Python 3.7
This lets the next commit make use of TypedDict &
Literal which were only introduced in Python 3.8.
2022-01-27 22:07:12 +01:00
Martin Fischer 7f89adc5f3 [pyright:strict] searx.shared.shared_abstract 2022-01-27 22:07:12 +01:00
Martin Fischer 1b03db4c73
Merge pull request #830 from return42/fix.828
[fix] docs - don't add plugins twice
2022-01-27 08:37:38 +01:00
Markus Heiser bdc28e3353 [fix] docs - don't add plugins twice
The PluginStore is already initalized when the application is initalized

    searx.plugins.initialize(application)

BTW: remove unneeded Flask import

Closes: https://github.com/searxng/searxng/issues/828
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-27 08:27:41 +01:00
Paul Braeuning 2c6bd2adf6
Merge pull request #825 from MontyQI/ui-changes
Simple theme uppercase buttons
2022-01-26 18:09:11 +01:00
Monty f59afc8dd2 Uppercase buttons 2022-01-26 16:54:15 +01:00
Markus Heiser c110a58a89
Merge pull request #820 from return42/ign-monkey
[test.pyright] suppress warnings about intentional monkey patching
2022-01-26 14:52:46 +01:00
Markus Heiser ccffab3a43
Merge pull request #813 from MarcAbonce/change-wolfram-category
Move WolframAlpha away from Science category
2022-01-26 14:10:19 +01:00
Markus Heiser 73a6da4dd9 [test.pyright] suppress warnings about intentional monkey patching
The warnings:

- "logger" is not defined'
- "supported_languages" is not defined'
- "language_aliases" is not defined'

are very verbose and superfluous, since these messages are related to
intentional monkey patching.

[1] https://github.com/searxng/searxng/pull/783#issuecomment-1019818178

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-25 23:26:53 +01:00
Markus Heiser e5f266065c
Merge pull request #824 from dalf/fix-simple-pref-checker
[fix] simple theme: don't crash when the checker is enabled
2022-01-25 23:01:31 +01:00
Markus Heiser 334a89f399
Merge pull request #822 from return42/invidious-setup
[mod] improve setup of invidious engine
2022-01-25 22:44:09 +01:00
Alexandre Flament dfb9ca527d [fix] simple theme: don't crash when the checker is enabled
The macro "checkbox" in macros.html uses the macro "icon_small"
from icons.html

The commit imports icon_small in macros.html to fix the issue.
It works because the macros in macros.html are imported with the Jinja2 context.

See https://jinja.palletsprojects.com/en/3.0.x/templates/#import-visibility

close #819
2022-01-25 22:03:21 +01:00
Markus Heiser 10c9b9775d [mod] improve setup of invidious engine
- My experience is, that a timeout of 5 sec is not need, I got fast response
  less than a second.

- https://invidious.tube/ redirects to http://ww25.invidious.tube/
  - in SearXNG defaults the http protocol is unsafe and raise an error
  - https://ww25.invidious.tube has SSL_ERROR_UNSAFE_NEGOTIATION

Related-to: https://github.com/searxng/searxng/issues/821
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-25 19:02:11 +01:00
Alexandre Flament 81453a0eba
Merge pull request #811 from return42/enh-788
[mod] configuration to overwrite engine description
2022-01-25 06:55:12 +01:00
Martin Fischer 973a2a57a1
Merge pull request #815 from mrpaulblack/add-sec-policy
[enh] add security policy
2022-01-25 02:58:10 +01:00
mrpaulblack 413bfb304f [enh] add security policy 2022-01-25 00:56:20 +01:00
Alexandre Flament 576eab04d2
Merge pull request #802 from MontyQI/Icon-update
Changed preferences icon to settings icon in gruntfile
2022-01-24 22:05:55 +01:00
Martin Fischer 7ce7625117
Merge pull request #804 from return42/minor-fix
[mod] lib_nvm.sh: minor improvements / no functional change
2022-01-24 17:58:16 +01:00
Markus Heiser b2018a88d1
Merge pull request #816 from return42/fix-emacs
[emacs] flycheck should use the eslint checker from developer tools
2022-01-24 11:56:19 +01:00
Markus Heiser 7cf8f14752 [emacs] flycheck should use the eslint checker from developer tools
Since commit cac03529 the eslint has been moved from the local nvm to the
developer packages (in `./node_modules`).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-24 11:34:34 +01:00
Martin Fischer 1f15d50aac
Merge pull request #783 from not-my-profile/pyrightconfig.json
[enh] add pyrightconfig.json and integrate pyright into CI
2022-01-24 08:02:00 +01:00
Markus Heiser 309147d86f [mod] introduce node.env.devtools function 2022-01-24 07:51:31 +01:00
Marc Abonce Seguin 1311745f24 move WolframAlpha away from Science category 2022-01-23 23:24:02 -06:00
Markus Heiser e0b284e427 [mod] configuration to overwrite engine description
Engine description can be configured, this is needed e.g. by custom search
engines.  Here is an example of a command engine with a description in the about
section::

    - name: locate
      engine: command
      command: ['locate', '{{QUERY}}']
      disabled: true
      categories: files
      about:
        description: local files
        website: 'https://www.man7.org/linux/man-pages/man1/locate.1.html'
      delimiter:
          chars: ' '
          keys: ['line']

Closes: https://github.com/searxng/searxng/issues/788
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 20:55:14 +01:00
Alexandre Flament 61853aa0fb
Merge pull request #799 from return42/brave-complete
Add autocompleter from Brave
2022-01-23 19:23:06 +01:00
Markus Heiser e9588b70a6 [fix] brave autocompleter: charset_normalizer issues
Use httpx.Response.json() to avoid charset_normalizer issues:

DEBUG   charset_normalizer            : override steps (5) and chunk_size (512) as content does not fit (153 byte(s) given) parameters.
INFO    charset_normalizer            : ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
DEBUG   charset_normalizer            : ascii should target any language(s) of ['Latin Based']
INFO    charset_normalizer            : ascii is most likely the one. Stopping the process.

[1] https://www.python-httpx.org/api/#response

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 17:22:13 +01:00
Markus Heiser 1a210e653c
Merge pull request #807 from spalinger/master
[fix] url
2022-01-23 12:09:58 +00:00
Alexandre Flament a8d54cfcab
Merge pull request #758 from not-my-profile/introduce-userdoc
Introduce `searx/help/`
2022-01-23 11:35:24 +01:00
Markus Heiser 9c5bac4c43 [pylint] searx/autocomplete.py
Fix remarks from pylint, BTW set SPDX-License-Identifier.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 09:12:03 +01:00
Martin Fischer 105c5a6a98 [help] stop rendering documentation with Jinja2
To facilitate translation of the user documentation we move
the templating logic outside of the user documentation.
2022-01-23 08:01:55 +01:00
Martin Fischer 284ac8bfd8 [help] convert about.html to Markdown
To facilitate translation the new user documentation shall be written in
Markdown (which is more human-friendly than HTML and reStructuredText).
2022-01-23 08:01:55 +01:00
Martin Fischer 05149db4c1 [help] render user documentation once on startup
Currently we have two kinds of user documentation:

* the about page[1] which is written in HTML and part of the web
  application and can therefore link instance-specific pages
  (like e.g. the preferences) via Jinja variables

* the Sphinx documentation[2] which is written in reStructuredText
  and cannot link instance-specific pages since it doesn't know
  which instance the user is using

The plan is to integrate the user documentation currently in Sphinx
into the application, so that it can also link instance specific pages.
We also want to enable the user documentation to be translated.

This commit implements the first step in this endeavor (see #722).

[1]: searx/templates/__common__/about.html
[2]: docs/user/ (currently served at https://docs.searxng.org/user/)
2022-01-23 08:01:55 +01:00
Martin Fischer cac0352986 [mod] remove .nvm_packages, add eslint to package.json 2022-01-23 08:00:39 +01:00
Martin Fischer 6d701d2fea [fix] ensure that test.pyright installs pyright
nodejs.ensure only sets up NVM if there isn't a system-wide
installation of Node that matches our NODE_MINIMUM_VERSION.

The ubuntu image in the CI comes with an up to date node version,
so pyright from .nvm_packages is never installed.

This commit fixes this by introducing a package.json file.
2022-01-23 08:00:39 +01:00
Martin Fischer 96450b17d4 [mod] add test.pyright to test & ci.test targets
Since we currently have many type checking errors,
we for now only test with typeCheckingMode: off
which makes pyright only check files that contain a comment:

    # pyright: basic

to enable basic type checking, or

    # pyright: strict

to enable strict type checking.
2022-01-23 08:00:39 +01:00
Martin Fischer 3cd5ce55e8 [enh] clarify why we run pyright in the pyenv 2022-01-23 08:00:39 +01:00
Markus Heiser aaf616fbd6 [emacs] .dir-locals.el: activate pyright in python-mode
To get in use of pyright type cheker in Emacs, a pyright installation [1] is
needed and in Emacs the lsp-pyright package has to be installed::

    M-x package-install lsp-pyright

[1] https://github.com/Microsoft/pyright
[2] https://github.com/emacs-lsp/lsp-pyright

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 08:00:39 +01:00
Markus Heiser 8342773216 [mod] manage test.pyright: a commandline to run pyright tests
This patch implements the command and Makefile target::

    ./manage test.pyright
    make test.pyright

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 08:00:39 +01:00
Markus Heiser 5d9188c7e9 [mod] add pyright to nvm's node installation
Pyright [1] is in the nvm enviroment, may be you need to rebuild the nvm
environment and install nodejs in::

    ./manage nvm.clean
    ./manage nvm.nodejs

The last command installs nodejs and the packages from .nvm_packages.

You can test your pyright installation, to get a bash within the nvm run::

   ./manage nvm.bash

   (nvm) $ which pyright
   ./.nvm/versions/node/v16.13.0/bin/pyright

If you have a local nvm in your HOME folder, the output from ``which`` is
different.  Press ``[CTRL-D]`` to get out of this bash.

[1] https://github.com/microsoft/pyright

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 08:00:39 +01:00
Markus Heiser 87c8c5fd1b [fix] pyrightconfig.json include only dedicated folders in the test
Without specifying folders to check, pyright will also scan files in folders
like ./build, ./cache, ./.nvm and more.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23 08:00:39 +01:00
Martin Fischer 5ce3091837 [enh] add pyrightconfig.json
By adding this file Pyright automatically detects the
packages from our Python virtual environment.

This can be tested by using the Pyright extension
for VS Code or by running npx pyright.
2022-01-23 08:00:39 +01:00
spalinger 6acc5b474f
[fix] url 2022-01-23 02:55:17 +01:00
Markus Heiser a163385474 [mod] lib_nvm.sh: minor improvements / no functional change
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-22 19:57:25 +01:00
Alexandre Flament 382f4f8fb0
Merge pull request #801 from dalf/fix-checker
[fix] checker: fix image fetch
2022-01-22 19:29:29 +01:00
Monty 80530befdc [build] /static 2022-01-22 17:23:43 +01:00
Monty 91ca5d1613 Changed preferences icon to settings icon in gruntfile 2022-01-22 17:14:19 +01:00
Alexandre Flament 5439dd5fb1 [fix] checker: fix image fetch
Since https://github.com/searxng/searxng/pull/354
the searx.network.stream(...) returns a tuple

This commits update the checker code according to
this function signature change.
2022-01-22 16:11:42 +01:00
Alexandre Flament f01ddd1932
Merge pull request #775 from return42/redis-4.1.1
Revert "[hotfix] interim fix to get docker-build of CI without issues"
2022-01-22 15:56:15 +01:00
Allen b8c98c4c0d [enh] Add autocompleter from Brave
Raw response example: https://search.brave.com/api/suggest?q=how%20to:%20with%20j

Headers are needed in order to get a 200 response, thus Searx user-agent is used.

Other URL param could be  '&rich=false' or  '&rich=true'.

Cherry-pick: 71786bf9cb
2022-01-21 14:39:10 +01:00