Commit Graph

532 Commits (2de007138ca1820e865c574cc13429d5da3f019f)

Author SHA1 Message Date
Markus Heiser 2de007138c [fix] prepare for pylint 2.14.0
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>
2 years ago
Léon Tiekötter 7e95d6bb79 [mod] image proxy: allow binary/octet-stream mime type
The Petal Search Images engine sends the thumbnails with the binary/octet-stream mime type.
2 years ago
Julian Fairfax 7d443dfea3 Preferences URL in preferences
Revert translation changes

Auto-save preferences from URL

Preferences URL in preferences

Fix that

Preferences URL in preferences
2 years ago
mrpaulblack c69c61838b [fix] autocomplete and infinite scroll persistence in preferences
* fixes a regression from https://github.com/searxng/searxng/pull/1186
2 years ago
Léon Tiekötter 18b8bbc017
[fix] PR 1186: GET method
PR https://github.com/searxng/searxng/pull/1186 prevented the GET method from being selected.
2 years ago
Alexandre Flament 9b3efa6d8a theme: remove __common__ 2 years ago
Markus Heiser 4326009d00 [format.python] based on bugfix in 9ed626130 2 years ago
Markus Heiser 444b1e70db [mod] add setting: search.autocomplete_min
Minimun characters to type before autocompleter starts.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Markus Heiser ed2a4c8087 [mod] client_settings: pass settings from server to JS client
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Alexandre FLAMENT 550f70b1aa Add support for the Silesian language 2 years ago
HZH c7de5c043c
fix: %2F in path will be converted to " › " 2 years ago
HZH 57a3252ff1
Unquote path on result page. 2 years ago
Austin Huang 96b8aac826
Extra null safety
Co-Authored-By: Alexandre Flament <alex.andre@al-f.net>
2 years ago
Austin Huang 6353b850b0
[fix] merge fake "plugins" endpoint back to "static"
https: //matrix.to/#/!vxScbLNEAmRvOraXBn:matrix.org/$0zqTtH3s-eVKlMwiAgiEJdetOkRx27EIRs-C0o8FzSg?via=libera.chat&via=matrix.org&via=tchncs.de
Co-Authored-By: Alexandre Flament <alex.andre@al-f.net>
2 years ago
Austin Huang e09d2ad4a7
[fix] return correct plugin path
closes #1021
2 years ago
Markus Heiser fd5fcdedce [interim fix] static files can't be delivered by HTTP.
Since PR 932 [1][2] static files can't be delivered by HTTP server any longer.

This patch makes the hash paramter in the URL of static files:

    /static/themes/simple/css/searxng.min.css?5fde34a74bc438c7b56ec8c6501e131cc9914bd8

optional.  By default the hash parameter is disabled.

HINT:

  Instances that do not deliver static files by their HTTP server and have a
  long expire time [3] should enable this option.

----

This is only a interim solution, on the long run:

    make static.build.commit

creates files including the file name:

    css/searxng-5fde34a74bc438c7b56ec8c6501e131cc9914bd8.min.css

and a mapping.json with this content[4]

[1] https://github.com/searxng/searxng/issues/964
[2] https://github.com/searxng/searxng/pull/932#issuecomment-1067039518
[3] 5583336440
[4] https://github.com/searxng/searxng/pull/932#issuecomment-1067216426

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Markus Heiser 3201aa1b3f
Merge pull request #859 from return42/fix-814
[mod] add i18n infrastructure for SearXNG message files (searxng.msg)
2 years ago
Alexandre Flament dbe3eaabc9 Info: code refactoring & bug fixes 2 years ago
Markus Heiser 784bf9ed15 [mod] move category and names of constants to searx/searxng.msg
Closes: https://github.com/searxng/searxng/issues/814
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Alexandre Flament 1157462ff9 Various change on PR 930 2 years ago
Markus Heiser b1912607ae [mod] replace /help by /info pages and include pages in project docs
This patch implements a bolierplate to share content from info-pages of the
SearXNG instance (URL /info) with the project documentation (path /docs/user).

The info pages are using Markdown (CommonMark), to include them in the project
documentation (reST) the myst-parser [1] is used in the Sphinx-doc build chain.

If base_url is known (defined in settings.yml) links to the instance are also
inserted into the project documentation::

    searxng_extra/docs_prebuild

[1] https://www.sphinx-doc.org/en/master/usage/markdown.html

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Alexandre Flament 1c7d8815fb [mod] URL for the static file contains the sha1
* allow to cache the static file forever
* avoid bugs when the static files are updated but not reloaded
2 years ago
mrpaulblack 21e3c40516 [simple theme] replace Image_layout.js with flexbox CS impl.
* drop image_layout.js from simple theme
* move image_layout.js to oscar theme and delete common js dir (since its empty now)
* align top position of image detail modal with bottom position of search header
* use flexbox to display images; row height can be set via @results-image-row-height in defenitions.less
* display span title underneath each image with a max width of 12rem
* increase margin and padding around image article on desktop and tablet
* make article height smaller on phone layout (height of 6rem) to display more content on current view
* remove content from result, if the title and content matches
* use a group that cotains the flex image article, if images are mixed with other categories
* fix pylint issues in webapp.py
* use the default.html result template in unit tests (thanks @return42)
2 years ago
Alexandre Flament 56e34947a6 [mod] infinite_scroll as preference
* oscar theme: code from searx/plugins/infinite_scroll.py
* simple theme: new implementation

Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
2 years ago
Markus Heiser c2d9c93b3b [fix] image_proxy: allow HTTP redirects
Without redirects the load of various images will fail when image_proxy is
enabled [1].

[1] https://github.com/searxng/searxng/pull/910#issuecomment-1045966577
Suggested-by: @dalf [1]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Martin Fischer 14338e2c3b [enh] generate navigation for help pages 2 years ago
Martin Fischer fb9eedbf40 [enh] introduce /help route
Translation will be implemented in the future.
For now the "en" in /help/en/<pagename> is hardcoded.
2 years ago
Martin Fischer 506169f312 [pyright] remove no longer needed assertion
The pyright bug[1] for which the assertion was added has been fixed.

[1]: https://github.com/microsoft/pyright/issues/2930
2 years ago
Martin Fischer b767752d0c [pyright:basic] searx.webapp 2 years ago
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>
2 years ago
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/)
2 years ago
Martin Fischer 96655cbd4e [typing] add type hints to webapp.py 2 years ago
Martin Fischer 193b0efd12 [typing] add results.UnresponsiveEngine 2 years ago
Martin Fischer 0c6a09cae3 [refactor] remove never used parameter 2 years ago
Martin Fischer fdf562bc32 [typing] add results.Timing 2 years ago
Martin Fischer 1ed618222f [typing] add ExtendedRequest
webapp.py monkey-patches the Flask request global.
This commit adds a type cast so that e.g. Pyright[1]
doesn't show "Cannot access member" errors everywhere.

[1]: https://github.com/microsoft/pyright
2 years ago
Martin Minka b76a815827 [fix] filtered_engines were not correctly evaluating validate_token() 2 years ago
Alexandre Flament aedd6279b3
Merge pull request #634 from not-my-profile/powered-by
Introduce `categories_as_tabs` & group engines in tabs
2 years ago
Alexandre Flament 2134703b4b [enh] settings.yml: implement general.enable_metrics
* allow not to record metrics (response time, etc...)
* this commit doesn't change the UI. If the metrics are disabled
  /stats and /stats/errors will return empty response.
  in /preferences, the columns response time and reliability will be empty.
2 years ago
Martin Fischer a4c2cfb837 [enh] change categories_as_tabs from a list to a dict
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
2 years ago
Martin Fischer 1e195f5b95 [mod] move group_engines_in_tab to searx.webutils 2 years ago
Martin Fischer ab90e2ac49 [enh] show categories not in any tab category in "Other" preferences tab
Previously we didn't have a good place to put search engines that don't
fit into any of the tab categories. This commit automatically puts
search engines that don't belong to any tab category in an "other"
category, that is only displayed in the user preferences (and not above
search results).
2 years ago
Martin Fischer 31e206361f [enh] group engines in preference tabs 2 years ago
Martin Fischer 8e9ad1ccc2 [enh] introduce categories_as_tabs
Previously all categories were displayed as search engine tabs.
This commit changes that so that only the categories listed under
categories_as_tabs in settings.yml are displayed.

This lets us introduce more categories without cluttering up the UI.
Categories not displayed as tabs  can still be searched with !bangs.
2 years ago
Markus Heiser 8f3a7feb47 [mod] implement is_hmac_of() in webutils / close to new_hmac()
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>, Alexandre Flament
2 years ago
Alexandre Flament d784870209 [fix] use hmac.compare_digest instead of ==
see https://docs.python.org/3/library/hmac.html#hmac.HMAC.hexdigest
2 years ago
Markus Heiser 3d96a9839a [format.python] initial formatting of the python code
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>
2 years ago
Markus Heiser fcdc2c2cd2 [format.python] disable py code formatting for some hunks of code
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>
2 years ago
Markus Heiser 0c8ff97d9e [fix] route /autocompleter: escape `<` and `>` in the simple theme
This is a follow up of 9a3253fc escaping `<` and `>` in all themes.  This patch
fix issue in oscar theme

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 9a3253fc16 [fix] route /autocompleter: escape '<' and '>' in the response
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago