Commit Graph

356 Commits

Author SHA1 Message Date
Noémi Ványi ba7c8d7b96 [fix] remove usage of request context where not available 2020-04-17 23:39:48 +02:00
Markus Heiser 4d64828237 webapp.py: expose the brand variable in the /config URL.
E.g. helpful for searx-stats2

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-25 17:28:32 +01:00
Markus Heiser ace7d30aed webapp.py: partial code review (no functional change)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-25 17:12:02 +01:00
Markus Heiser 04c687403e [fix] brands: add variables from build env to jinja templating
We have some variables in the build environment which are also needed in the
templating process.  Theses variables are relavant if one creates a fork with
its own branding.  We treat these variables under the term 'brands'.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-03-25 11:49:33 +01:00
Adam Tauber 822aee94a2 [fix] remove debug print 2020-03-16 00:22:38 +01:00
Adam Tauber baca55c94e [fix] handle weights in accept language parsing - fixes w3ms en;q=1.0 2020-03-16 00:22:15 +01:00
Adam Tauber 58a630308a [fix] convert query to string to produce valid filename for csv output 2020-03-13 00:57:01 +01:00
Adam Tauber 018b681841 [fix] add answers, suggestions, corrections to csv output
fixes #1888
2020-03-13 00:50:19 +01:00
Adam Tauber 9bc24080bf [fix] add answers, suggestions, corrections to rss output
fixes #1888
2020-03-13 00:43:05 +01:00
Marc Abonce Seguin 51e78211de monkey patch babel get_translations to support Occitan 2020-02-23 21:46:26 -07:00
Marc Abonce Seguin c0006cadf7 fix default locale and language issues 2020-02-23 02:03:42 -07:00
Markus Heiser 7c79eb9b1b Merge commit 'refs/pull/1621/head' of https://github.com/asciimoo/searx
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-02-08 15:08:33 +01:00
Noémi Ványi 99435381a8 [enh] introduce private engines
This PR adds a new setting to engines named `tokens`.
It expects a list of tokens which lets searx validate
if the request should be accepted or not.
2020-02-08 11:47:39 +01:00
Nicolas Gelot b8b13372c8 Fix deprecated werkzeug import
Close: #1830
Signed-off-by: Nicolas Gelot <nicolas.gelot@e.email>
2020-02-06 22:49:35 +01:00
Adam Tauber 8e3bd3fcbd [mod] add py2 deprecation warning to webapp 2020-01-28 15:52:50 +01:00
Marc Abonce Seguin 495ae59b31 hide suggestions box if empty
This bug happens only in python3
because map returns an iterator.
2019-12-21 22:47:08 -06:00
Adam Tauber 731e34299d
Merge pull request #1744 from dalf/optimizations
[mod] speed optimization
2019-12-02 13:39:58 +00:00
lorddavidiii 5e5ff0cbf8 webapp.py: use html.escape if cgi.escape is not available
- cgi.escape was removed in python 3.8
- also use html.escape in framalibre.py
2019-11-16 21:58:25 +01:00
Dalf 85b3723345 [mod] speed optimization
compile XPath only once
avoid redundant call to urlparse
get_locale(webapp.py): avoid useless call to request.accept_languages.best_match
2019-11-15 09:33:15 +01:00
Marc Abonce Seguin b0f89ed477 [fix] preserve bangs in corrections 2019-10-22 21:41:50 -07:00
Noémi Ványi a6f20caf32 add initial support for offline engines && command engine 2019-10-16 15:52:48 +02:00
Alexandre Flament 72029d27de
[enh] Add timeout limit per request (#1640)
The new url parameter "timeout_limit" set timeout limit defined in second.
Example "timeout_limit=1.5" means the timeout limit is 1.5 seconds.

In addition, the query can start with <[number] to set the timeout limit.

For number between 0 and 99, the unit is the second :
Example: "<30 searx" means the timeout limit is 3 seconds

For number above 100, the unit is the millisecond:
Example: "<850 searx" means the timeout is 850 milliseconds.

In addition, there is a new optional setting: outgoing.max_request_timeout.
If not set, the user timeout can't go above searx configuration (as before: the max timeout of selected engine for a query).

If the value is set, the user can set a timeout between 0 and max_request_timeout using
<[number] or timeout_limit query parameter.

Related to #1077
Updated version of PR #1413 from @isj-privacore
2019-08-02 13:50:51 +02:00
Marc Abonce Seguin 59b1370824 [fix] small fixes in preferences view's text 2019-07-27 22:53:46 -07:00
Dalf 2fab23ab9a [fix] fix the debug message "starting webserver on ip:port"
was "port:ip"
2019-07-27 08:52:30 +02:00
Alexandre Flament 554a21e1d0
[enh] Add Server-Timing header (#1637)
Server Timing specification: https://www.w3.org/TR/server-timing/

In the browser Dev Tools, focus on the main request, there are the responses per engine in the Timing tab.
2019-07-17 10:38:45 +02:00
Dalf c7220b40ea Suggestions: use RawTextQuery to make the suggestions URLs. Update all themes accordingly. 2019-07-17 09:05:29 +02:00
Marc Abonce Seguin 6626f01365 [fix] preserve bangs in suggestions and corrections 2019-07-01 19:52:34 -05:00
Marc Abonce Seguin 40272b0044 [fix] never pass bangs to autocomplete suggestions 2019-07-01 17:16:02 -05:00
Nicolas Gelot 373a66be30 Fix locale and search language
Locale and search language was always defined with english value.

This patch inits the locale on `pre_request` in order to define the
default value of locale and language preferences.

Plus the `best_match` function provided by flask babel library did not
work as expected. So the function `match_language` provided
by searx is used to detect that the language from Accepted-Language
header can be used in searx project.
2019-06-17 23:19:15 +02:00
Nicolas Gelot a818d3241d Remove get local from request.args
args parameters are merged in form in pre_request, so
this patch removes that useless operation.
2019-06-17 23:13:04 +02:00
rachmadaniHaryono 535fff109f fix: dev: python3 dict keys jsonify 2019-05-18 00:03:49 +08:00
Venca24 e8734b37c9 [FIX] image_proxify 2019-01-18 09:04:40 +01:00
Noémi Ványi b63d645a52 Revert "remove 'all' option from search languages"
This reverts commit 4d1770398a.
2019-01-07 21:19:00 +01:00
Marc Abonce Seguin 772c048d01 refactor engine's search language handling
Add match_language function in utils to match any user given
language code with a list of engine's supported languages.

Also add language_aliases dict on each engine to translate
standard language codes into the custom codes used by the engine.
2018-03-27 00:08:03 -06:00
Adam Tauber b9d4c0523e [fix] get doi_rewriters from settings - fixes #1245 2018-03-17 09:38:36 +01:00
Adam Tauber b70ce84eb6 [enh] update translations - add taiwanese and filipino 2018-02-19 00:22:39 +01:00
Adam Tauber 49b845051f
Merge pull request #973 from MarcAbonce/languages
Remove 'all' option from search languages
2017-12-06 14:34:26 +01:00
marc 4d1770398a remove 'all' option from search languages 2017-12-06 01:20:15 -06:00
Adam Tauber e060aedc16 [enh] make custom oscar option configurable from url 2017-12-05 22:30:20 +01:00
Adam Tauber f65f90bf3c [fix] autocompleter py3 compatibility - fixes #1088 2017-11-23 17:42:52 +01:00
yujunqiang ed1c78d923 fix bug: TypeError: set(['bing', 'google']) is not JSON serializable, when curl 'http://127.0.0.1:8888/?q=xxxxxxxx&categories=general&format=json' 2017-11-15 21:31:27 +08:00
Noémi Ványi 1b10abfc92 minor fixes of doi resolver
Closes #1047
2017-11-01 17:02:38 +01:00
jibe-b 575159b194 [enh] oa_doi_rewrite plugin broadens doai_rewrite 2017-11-01 14:22:26 +01:00
Adam Tauber 5f758b2d39 [mod] compress saved preferences in url 2017-10-26 00:06:03 +02:00
Noémi Ványi e73cb14889 fix hmac python3 compatibility 2017-09-08 21:33:11 +02:00
misnyo ae99f9070c [fix] static path fixed in templates and webapp, line endings fixed 2017-09-08 20:33:14 +02:00
Adam Tauber f2b13a7de0 [enh] allow default empty values for normal and result proxies 2017-07-20 13:32:20 +02:00
Noémi Ványi 243d3e4298 show engine errors in infobox && add new error alert 2017-07-12 16:29:11 +02:00
Adam Tauber 38d6ba4066 [enh] generate search url of saved preferences 2017-07-10 12:50:13 +02:00
Adam Tauber 6d76d9b202 [fix] load engines if debug mode is enabled using uwsgi 2017-06-12 12:47:42 +02:00