summaryrefslogtreecommitdiff
path: root/searx/webapp.py
AgeCommit message (Collapse)Author
2021-04-21[mod] oscar: /preferences , engines tab: report engine timesAlexandre Flament
* display the median time instead of the average. * add a "Reliability" column (sum up the metrics and the checker results). * the "selected language", "SafeSearch", "Time range" values are displayed as "broken" when the checker tests fail.
2021-04-21[enh] rewrite and enhance metricsAlexandre Flament
2021-04-21[mod] refactoring: processorsAlexandre Flament
Report to the user suspended engines. searx.search.processor.abstract: * manages suspend time (per network). * reports suspended time to the ResultContainer (method extend_container_if_suspended) * adds the results to the ResultContainer (method extend_container) * handles exceptions (method handle_exception)
2021-04-21Merge remote-tracking branch 'return42/fix-preference-save'Alexandre Flament
2021-04-21Merge remote-tracking branch 'return42/fix-url-bar-suggestion'Alexandre Flament
2021-04-12[httpx] replace searx.poolrequests by searx.networkAlexandre Flament
settings.yml: * outgoing.networks: * can contains network definition * propertiers: enable_http, verify, http2, max_connections, max_keepalive_connections, keepalive_expiry, local_addresses, support_ipv4, support_ipv6, proxies, max_redirects, retries * retries: 0 by default, number of times searx retries to send the HTTP request (using different IP & proxy each time) * local_addresses can be "192.168.0.1/24" (it supports IPv6) * support_ipv4 & support_ipv6: both True by default see https://github.com/searx/searx/pull/1034 * each engine can define a "network" section: * either a full network description * either reference an existing network * all HTTP requests of engine use the same HTTP configuration (it was not the case before, see proxy configuration in master)
2021-04-12[fix] redirect when saving preferencesMarkus Heiser
Erroneously commit 87e4c4762 droped the 302 redirect. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-04-10[enh] replace requests by httpxAlexandre Flament
2021-04-07[fix] fix PR 2656Alexandre Flament
SCRIPT_NAME remove trailing slash to avoid infinite redirect
2021-04-05Merge pull request #2656 from return42/fix-url_forAlexandre Flament
[fix] url_for(..., _external=True) in templates
2021-04-05[fix] url_for(..., _external=True) in templatesMarkus Heiser
The `url_for` function in the template context is not the one from Flask, it is the one from `webapp`. The `webapp.url_for_theme` is different from its namesake of Flask and has it quirks, when called with argument `_external=True`. The `webapp.url_for_theme` can't handle absolute URLs since it pokes a leading '/', here is the snippet of the old code:: url = url_for(endpoint, **values) if settings['server']['base_url']: if url.startswith('/'): url = url[1:] url = urljoin(settings['server']['base_url'], url) Next drawback of (Flask's) `_external=True` is, that it will not return the HTTP scheme when searx (the Flask app) listens on http and is proxied by a https server. To get the right scheme `HTTP_X_SCHEME` is needed by Flask (werkzeug). Since this is not provided in every environment (e.g. behind Apache mod_wsgi or the HTTP header is not fully set for some other reasons) it is recommended to get *script_name*, *server* and *scheme* from the configured `base_url`. If `base_url` is specified, then these values from are given preference over any Flask's generics. BTW this patch normalize to use `url_for` in the `opensearch.xml` and drop the need of `host` and `urljoin` in template's context. Signed-off-by: Markus Heiser <markus@darmarit.de>
2021-04-04[fix] publishedDate: don't try to get date from empty string or NoneMarkus Heiser
Signed-off-by: Markus Heiser <markus@darmarit.de>
2021-04-03[fix] url bar autocomplete (opensearch suggestions)Markus Heiser
Since #2593 is merged the OpenSearch-Format is buggy. The loop in [1] will change raw_text_query object and this will change also the value of `raw_text_query.query` on every `raw_text_query.changeQuery(result)`. This patch fixes this issue by storing the initial query value in `sug_prefix`. [1] https://github.com/searx/searx/blob/ac0fdc3b9670168de8061ed0e656dd66a567d741/searx/webapp.py#L804-L806 OpenSearch-Format:: [ "<query>", [ "<term 1>", "<term 2>", ... "<term n>" ], [ "<content 1>", "<content 2>", ..., "<content n>" ], [ "<url 1>", "<url 2>", ..., "<url n>" ] ] - https://www.google.com/support/enterprise/static/gsa/docs/admin/current/gsa_doc_set/xml_reference/query_suggestion.html#1080002 - https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Supporting_search_suggestions_in_search_plugins#implementing_search_suggestion_support_on_the_server Legacy-Format:: [ "<term 1>", "<term 2>", ..., "<term n>" ] - https://www.google.com/support/enterprise/static/gsa/docs/admin/current/gsa_doc_set/xml_reference/query_suggestion.html#1081079 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-03-22[mod] preferences: a tooltip is shown when the mouse is over the engine namesAlexandre Flament
2021-03-16[mod] replace /translations.js by embedded JSONAlexandre Flament
In webapp.py, there is a new function "get_translations" lists available translations Close #2064
2021-03-16[mod] upgrade pygmentsAlexandre Flament
add searx_extra/update/update_pygments.py to update the css style of the oscar and simple themes.
2021-03-06[enh] add ability to send engine data to subsequent requestsAdam Tauber
2021-03-01[enh] autocomplete refactoring, autocomplete on external bangsAlexandre Flament
2021-02-04[fix] get correct locale with country from browserMarc Abonce Seguin
Some of our interface locales include uppercase country codes, which are separated by `_` instead of the more common `-`. Also, a browser's `Accept-Language` header could be in lowercase. This commit attempts to normalize those cases so a browser's language+country codes can better match with our locales. This solution assumes that our UI locales have nothing more than language and optionally country. If we ever add a script specific locale like `zh-Hant-TW` this would have to change to accomodate that, but the idea would be pretty much the same as this fix.
2021-01-12[enh] checker: background checkAlexandre Flament
See settings.yml for the options SIGUSR1 signal starts the checker. The result is available at /stats/checker
2021-01-11[fix] add missing brand.CONTACT_URL to /config API endpointMarkus Heiser
Suggested-by: @dalf / https://github.com/searx/searx-stats2/issues/59#issuecomment-747961582 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-12-27[mod] check secret_key when searx.webapp is importedAlexandre Flament
Without this commit the module searx checks the secret_key value. With this commit, make docs, utils/standalone_searx.py, utils/fetch_firefox_version.py works without SEARX_DEBUG=1 For reference see https://github.com/searx/searx/pull/2386
2020-12-17[mod] split searx.search into different processorsAlexandre Flament
see searx.search.processors.abstract.EngineProcessor First the method searx call the get_params method. If the return value is not None, then the searx call the method search.
2020-12-03[enh] record details exception per engineAlexandre Flament
add an new API /stats/errors
2020-12-01[mod] pylint: numerous minor code fixesAlexandre Flament
2020-11-26Merge pull request #2327 from renyhp/masterAlexandre Flament
Add preference for displaying advanced settings
2020-11-26Remove unused linesrenyhp
2020-11-26Fix syntax errorrenyhp
2020-11-26Another patchrenyhp
2020-11-23Patch advanced search preferencesrenyhp
2020-11-22Add preference for displaying advanced settingsrenyhp
2020-11-20[enh] Add multiple outgoing proxiesAlexandre Flament
credits go to @bauruine see https://github.com/searx/searx/pull/1958
2020-11-17Fix type of unresponsive_enginesNoémi Ványi
Previously __get_translated_errors returned a list. But unresponsive_engines is a set. Closes #2305
2020-11-14[mod] remove unused importAlexandre Flament
use from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA so it is possible to easily remove all unused import using autoflake: autoflake --in-place --recursive --remove-all-unused-imports searx tests
2020-11-14Merge pull request #2289 from dalf/pylintAlexandre Flament
[mod] pylint: add extension-pkg-whitelist=lxml.etree
2020-11-14Merge pull request #2300 from dalf/fix-webapp-indexAlexandre Flament
[fix] fix of / and /search
2020-11-06[fix] fix of / and /searchAlexandre Flament
* URL / : the index page displayed the selected or the default category. * URL / : when the q parameter is set using the URL, the redirect includes the URL query. * URL /search : an empty query doesn't raise an exception.
2020-11-05[enh] add default http headers - closes #715Adam Tauber
2020-11-03[mod] pylint: minor code change to allow pylint globallyAlexandre Flament
This commit is only a step, it doesn't fix all the issues reported by pylint
2020-11-02[mod] separate index and search routesMarc Abonce Seguin
This makes it easier to separately handle search and index requests from a web server or from a reverse proxy. If a request to index contains a query, a permanent redirect HTTP response is returned. This should give some level of backwards compatibility for users that have set a searx instance in their browser's search bar.
2020-10-25[enh] Add onions category with Ahmia, Not Evil and Torcha01200356
Xpath engine and results template changed to account for the fact that archive.org doesn't cache .onions, though some onion engines migth have their own cache. Disabled by default. Can be enabled by setting the SOCKS proxies to wherever Tor is listening and setting using_tor_proxy as True. Requires Tor and updating packages. To avoid manually adding the timeout on each engine, you can set extra_proxy_timeout to account for Tor's (or whatever proxy used) extra time.
2020-10-25Let admins lock user preferencesNoémi Ványi
2020-10-08[fix] use base_url everywhere if it is defined in settings.ymlAdam Tauber
2020-10-06[fix] opensearch.xml URL contains method and autocomplete parametersAlexandre Flament
When the user add searx as a search engine, the browser loads the /opensearch.xml URL without the cookies. Without the query parameters, the user preferences are ignored (method and autocomplete). In addition, opensearch.xml is modified to support automatic updates, see https://developer.mozilla.org/en-US/docs/Web/OpenSearch
2020-10-05[mod] webapp.py: update engines initialization conditionAlexandre Flament
Always call initialize engines except on the first run of werkzeug with the reload feature. the reload feature is activated when: * searx_debug is True (SEARX_DEBUG environment variable or settings.yml) * FLASK_APP=searx/webapp.py FLASK_ENV=development flask run (see https://flask.palletsprojects.com/en/1.1.x/cli/ ) Fix SEARX_DEBUG=0 make docs docs/admin/engines.rst : engines are initialized See https://github.com/searx/searx/issues/2204#issuecomment-701373438
2020-09-28Merge pull request #2189 from dalf/architecture-clean-upAdam Tauber
Architecture clean up
2020-09-26[mod] upgrade requests to version 2.24.0. use ssl instead of pyopenssl.Alexandre Flament
requests 2.24.0 uses the ssl module except if it doesn't support SNI, in this case searx fallbacks to pyopenssl. searx logs a critical message and exit if the ssl modules doesn't support SNI and pyOpenSSL is not installed. searx logs a critical message and exit if the ssl version is older than 1.0.2. in requirements.txt, pyopenssl is still required to install searx as a fallback.
2020-09-24[mod] more typingAlexandre Flament
2020-09-22[mod] searx/webadapter.py: add get_selected_categories share common code ↵Alexandre Flament
with get_search_query_from_webapp Update searx/webapp.py to use get_selected_categories Close #2142
2020-09-22[mod] check the engine tokens in searx/webadapter.py instead of searx/search.pyAlexandre Flament