Commit Graph

512 Commits (b1912607ae9783d6ccf648bd7706a64eca5bedb9)

Author SHA1 Message Date
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
Alexandre Flament 42c1a938f0
Merge pull request #485 from dalf/pref_query_in_title
[mod] new preference: query_in_title
3 years ago
mrpaulblack f3aff26086 [simple theme] rework select; add safesearch to search and replace / with › in article url
* rework selection UI in pref (fix based on: 78643e9f43)
* moved search filters underneath categories
* cut params from url and replace / with ›
* make h3 and url in article bigger
* add safe search select to search filter (this will not override settings and only be valid while on result page in a session)
* make search form button not overlap each other when js is disabled
* 1rem padding around preview image and thumbnail in default article template
3 years ago
Alexandre Flament ec5a82fccd [enh] simple theme: add "simple-style" preferences 3 years ago
Alexandre Flament 80fb77476f [mod] new preference: query_in_title
* disable by default
* settings.yml: ui.query_in_title
* in /preferences: privacy tab

when enabled, the result page's title contains the user query.

previously:
* oscar theme: the query was always included
* simple theme: the query was included with the GET method
3 years ago
Igor Rzegocki 13c355c4c4 healthcheck endpoint 3 years ago
Alexandre Flament 60db344cc0 [enh] reduce the available language list
close #406

settings['search']['languages'] contains the languages codes and 'all'
3 years ago
Alexandre Flament ee5e9f9e1d
Merge pull request #380 from dalf/fix-339
[fix] interface language zh_CN and zh_TW don't work
3 years ago
Alexandre Flament a1d1aec6e2 [mod] locale: use hyphen everywhere except for Babel 3 years ago
Alexandre Flament 988910d451 [fix] templates: lang attribute of html uses hyphen
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-lang
https://www.w3.org/TR/REC-xml/#sec-lang-tag
3 years ago
Alexandre Flament f9c6393502 [enh] verify that Tor proxy works every time searx starts
based on @MarcAbonce commit on searx
3 years ago
Alexandre Flament 2b4fef7118 plugins: refactor initialization
add a new function "init" call when the app starts.
The function can:
* return False to disable the plugin.
* modify the Flask app.
3 years ago
Alexandre Flament a9c3c88cc0 [mod] searx.network.stream returns a tuple (response, stream) 3 years ago
Alexandre Flament 2f1384f198 [enh] themes: display the engine descriptions 3 years ago
Alexandre Flament bfd24d1226 [mod] add /engine_descriptions.json endpoint
returns engine descriptions (JSON):
* key: engine name
* value: description in the user locale, use English description as a fallback
3 years ago
Alexandre Flament fc20c561bf [mod] oa_doi_rewrite plugin: get_doi_resolver: remove args parameter
doi_resolvers.get_value('preferences') already contains the value from
request.args.get('doi_resolver')
3 years ago
Markus Heiser 2a3b9a2e26 [pylint] searx: drop no longer needed 'missing-function-docstring'
Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914168470
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Alexandre Flament 3c377c0aa8 [mod] searx.webapp: code clean up 3 years ago
Alexandre Flament 7dc370efe9 [enh] new issue: include information from searx.version 3 years ago
Alexandre Flament 3b0f70ed0f [mod] /image_proxy: use HTTP/1 instead of HTTP/2
httpx: HTTP/2 is slow when a lot data is downloaded.
https://github.com/dalf/pyhttp-benchmark

also, the usage of HTTP/1 decreases the load average
3 years ago
Alexandre Flament 43fcaa642a [fix] image_proxy: always close the httpx respone
previously, when the content type was not an image and some other error,
the httpx response was not closed
3 years ago