Commit Graph

495 Commits (3fbefb4d99ee4f8e2705f1537393dced94b53180)

Author SHA1 Message Date
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
3 years ago
Alexandre Flament d784870209 [fix] use hmac.compare_digest instead of ==
see https://docs.python.org/3/library/hmac.html#hmac.HMAC.hexdigest
3 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>
3 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>
3 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
Markus Heiser 29b40338d6
Merge pull request #260 from dalf/mod_locale
[mod] searx.webapp.get_locale: read locale from the preferences
3 years ago
Markus Heiser 8290f70e24 [fix] /config add missing GIT_BRANCH value
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Alexandre Flament 28ccf47ca4 [mod] searx.webapp.get_locale: read locale from the preferences
pre_request already set the locale.
3 years ago
Alexandre Flament f30d01ffab [mod] settings.yml: remove locales
There are detected from the searx/translations directory
3 years ago
Alexandre Flament 4b43775c91 version based on the git repository
This commit remove the need to update the brand for GIT_URL and GIT_BRANCH:
there are read from the git repository.

It is possible to call python -m searx.version freeze to freeze the current version.
Useful when the code is installed outside git (distro package, docker, etc...)
3 years ago
Markus Heiser 3f638ed196 [mod] drop usage of the searx.brand namespace (templates & /config)
In the templates and the /config (JSON) the usage of the 'brand.*' name
space is replaced by 'searx.get_setting' function.

- new_issue_url          --> get_setting('brand.new_issue_url')
- brand.GIT_URL          --> get_setting('brand.git_url')
- brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances')
- brand.DOCS_URL         --> get_setting('brand.docs_url')
- brand.ISSUE_URL        --> get_setting('brand.issue_url')
- brand.CONTACT_URL      --> get_setting('general.contact_url', '')

The macro 'new_issue' from searx/templates/*/messages/no_results.html
is now imported with context::

    {% from '__common__/new_issue.html' import new_issue with context %}

To get *public instances URL* from context's 'get_setting()' function::

    get_setting('brand.public_instances','')

Macro's prototype does no longer need the 'new_issue_url' argument and has been
changed to::

    macro new_issue(engine_name, engine_reliability)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 24f2376c11 [pylint] prepare for pylint v2.9.3 / fix some (new) pylint issues
Upgrade from pylint v2.8.3 to 2.9.3 raise some new issues::

  searx/search/checker/__main__.py:37:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
  searx/search/checker/__main__.py:38:26: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
  searx/search/processors/__init__.py:20:0: R0402: Use 'from searx import engines' instead (consider-using-from-import)
  searx/preferences.py:182:19: C0207: Use data.split('-', maxsplit=1)[0] instead (use-maxsplit-arg)
  searx/preferences.py:506:15: R1733: Unnecessary dictionary index lookup, use 'user_setting' instead (unnecessary-dict-index-lookup)
  searx/webapp.py:436:0: C0206: Consider iterating with .items() (consider-using-dict-items)
  searx/webapp.py:950:4: C0206: Consider iterating with .items() (consider-using-dict-items)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser d0daa87ce6 [coding-style] searx/webapp.py - normalize indentations
No functional change!

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Alexandre Flament 2a109d0a5f [mod] refactor searx.webapp.render
render automatically adds these variables to the template context:
* advanced_search
* all_categories
* categories
	before render was checking if the variable was already set
	but it is actually never set by the callers
3 years ago
Alexandre Flament 70bbd14b1a [mod] move hook to set Unix thread name into searx.unixthreadname
requires setproctitle (but optional)
3 years ago
Alexandre Flament 0e23113f70 [mod] remove unused filter searx.webapp.extract_domain
it was used in the pix-art theme
3 years ago
Alexandre Flament cfa07b0a9a [mod] refactor searx.webapp.render
no functional change, reorder declarations
3 years ago
Alexandre Flament 91856e8f6a [mod] refactor searx.webapp.render: remove unused parameters 3 years ago
Alexandre Flament 15567955b4 [mod] remove check of Python 2. 3 years ago
Alexandre Flament aedf0aa5fe [mod] remove searx.webapp.get_base_url function
see the result of:
git grep "base_url" searx/templates
"base_url" is not used any more.
3 years ago
Alexandre Flament eeb0998787 [mod] refactor: move Flask proxy fix to searx.flaskfix module 3 years ago
Alexandre Flament a7d575c099 [enh] flask debug mode: reload the app when searx/settings.yml changes 3 years ago