1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-14 00:30:15 +01:00
Commit Graph

457 Commits

Author SHA1 Message Date
Noémi Ványi
bce3830b8d [fix] translate engine errors to Occitan when configured 2020-04-17 23:39:48 +02:00
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
Alexandre Flament
87f673336f [fix] rss feed : the jinja template was not found when the rss feed returns an valid feed including an error. 2017-05-22 22:20:35 +02:00
Alexandre Flament
9c91ab33f8 [mod] settings.yml can be /etc/searx/settings.yml
The exact order is
* first from SEARX_SETTINGS_PATH,
* if not found then from searx code base,
* if not found then from /etc/searx/settings.yml
* if not found an exception stops searx loading
2017-05-15 22:19:42 +02:00
Alexandre Flament
ee080feaed [mod] the static and templates directories can be defined in the settings.yml 2017-05-15 21:23:13 +02:00
Adam Tauber
52e615dede [enh] py3 compatibility 2017-05-15 12:02:30 +02:00
Alexandre Flament
181c12ae04 [mod] upgrade requirements.txt 2017-03-23 21:26:51 +01:00
Alexandre Flament
e67dfaaac7 Merge branch 'master' into flask_perimeter 2017-01-27 13:47:59 +00:00
Alexandre Flament
15eef0ebdb [enh] validate input and raise an exception inside search.py. The exception message is output in json and rss format. 2017-01-20 18:52:47 +01:00
Alexandre Flament
7fdfeca3a4 [mod] add a __common__ template that can't be selected but that provides a common place for shared templates.
What has been moved into this template :
* opensearch*.xml is always the same whatever the themes.
* the text inside */about.html
2017-01-20 15:40:38 +01:00
David A Roberts
1d30141c20 [enh] show spelling corrections 2017-01-16 13:31:16 +10:00
Alexandre Flament
7a16aca346 Merge branch 'master' into flask_perimeter 2017-01-15 22:18:20 +01:00
Dalf
06bea82935 [mod] /config API : add language_support, paging, safesearch, supported_languages, time_range_support, timeout fields. 2017-01-07 14:42:55 +01:00
Alexandre Flament
84a2c97a65 [mod] searx uses flask framework only in webapp.py. Make migration to another framework easier. 2017-01-02 12:06:04 +01:00
Adam Tauber
7388067f15 [fix] load engines with uwsgi too 2016-12-28 21:17:51 +01:00
Adam Tauber
8bff42f049 Merge branch 'master' into languages 2016-12-28 20:00:53 +01:00
Adam Tauber
68cbf0448f [fix] do not reload engines twice if started with debug mode 2016-12-27 17:31:14 +01:00
Adam Tauber
a605377c40 [enh] explicit engine init 2016-12-27 17:31:14 +01:00
Adam Tauber
14f58bdaec [fix] robot tests ++ set default value for server http protocol version 2016-12-25 23:31:51 +01:00
Adam Tauber
a98bbefbcf [enh] configurable listening http protocol version 2016-12-25 23:05:01 +01:00
marc
f62ce21f50 [mod] fetch supported languages for several engines
utils/fetch_languages.py gets languages supported by each engine and
generates engines_languages.json with each engine's supported language.
2016-12-13 19:58:10 -06:00
marc
149802c569 [enh] add supported_languages on engines and auto-generate languages.py 2016-12-13 19:32:00 -06:00
Adam Tauber
a764ebb4b1 [enh] extend json response with suggestions, infoboxes and answers 2016-12-10 21:38:34 +01:00
Alexandre Flament
e48f07a367 Merge branch 'master' into searchpy2 2016-12-09 23:11:45 +01:00
Adam Tauber
d80fb2c8e8 [enh] central handling of empty result titles 2016-12-09 19:57:28 +01:00
Adam Tauber
ef2ef7974a [enh] central html escaping of results 2016-12-09 19:10:33 +01:00
Adam Tauber
971ed0abd1 [enh] add quick answer functionality with an example answerer 2016-11-19 20:53:51 +01:00
Adam Tauber
827f9e41ca [fix] gettext requires request.preferences 2016-11-15 09:56:18 +01:00
Adam Tauber
a757c2f005 [fix] remove unused imports 2016-11-14 22:15:03 +01:00
Adam Tauber
832cf37a97 [enh] display errors
also tried flask's flash feature but flask creates session cookies if it
isn't flushed. Avoiding session cookies to preserve privacy
2016-11-14 22:07:23 +01:00
Adam Tauber
94196c4b6c [enh] show traceback of search errors 2016-11-14 15:49:06 +01:00
Alexandre Flament
01e2648e93 Simplify search.py, basically updated PR #518
The timeouts in settings.yml is about the total time (not only the HTTP request but also the prepare the request and parsing the response)
It was more or less the case before since the threaded_requests function ignores the thread after the timeout even the HTTP request is ended.

New / changed stats :
* page_load_time : record the HTTP request time
* page_load_count: the number of HTTP request
* engine_time : the execution total time of an engine
* engine_time_count : the number of "engine_time" measure

The avg response times in the preferences are the engine response time (engine_load_time / engine_load_count)

To sum up :
* Search.search() filters the engines that can't process the request
* Search.search() call search_multiple_requests function
* search_multiple_requests creates one thread per engine, each thread runs the search_one_request function
* search_one_request calls the request function, make the HTTP request, calls the response function, extends the result_container
* search_multiple_requests waits for the the thread to finish (or timeout)
2016-11-05 13:45:20 +01:00
Alexandre Flament
58a6c045c8 [mod] replace references request.request_data (GET or POST parameters) by request.form (based on merge of POST and GET parameters) 2016-11-02 14:52:22 +01:00
dalf
67e11c42b9 Clean up the architecture
Purposes :
- isolate the plugins calls
- distinction between parsing the web request and running the search (Search class). To be able to test code easily, to run searx code outside a web server, to filter the search query parameters with plugins more easily, etc...

Details :
- request.request_data contains request.form or request.args (initialize inside pre_request() function)
- Query class is renamed RawTextQuery
- SearchQuery class defines all search parameters
- get_search_query_from_webapp create a SearchQuery instance (basically the previous Search.__init__ code)
- Search class and SearchWithPlugins class takes a SearchQuery instance as class constructor parameter
- SearchWithPlugins class inherites from Search class, and run plugins
- A dedicated function search_with_plugins executes plugins to have a well define locals() (which is used by the plugins code).
- All plugins code is executed inside the try...except block (webapp.py, index function)
- advanced_search HTTP parameter value stays in webapp.py (it is only part of UI)
- multiple calls to result_container.get_ordered_results() doesn't compute the order multiple time (note : this method was call only once before)
- paging value is stored in the result_container class (compute in the extend method)
- test about engine.suspend_end_time is done during search method call (instead of __init__)
- check that the format parameter value is one of these : html, rss, json, rss (before the html value was assumed but some text formatting wasn't not done)
2016-11-02 14:22:16 +01:00
Adam Tauber
6243639f01 [mod] do not proxify images if image proxy is not set 2016-10-30 21:15:46 +01:00
Noémi Ványi
6334fca11c add version info to config endpoint 2016-10-30 15:58:34 +01:00
Adam Tauber
1b9045ed89 [enh] use morty proxy for image proxification too if it is configured 2016-10-29 23:21:07 +02:00
Adam Tauber
a67a4bf2c0 [enh] allow morty proxy without hmac key 2016-10-29 23:21:07 +02:00
Adam Tauber
574d9d40d2 Merge pull request #697 from Eig8phei/http1.1
serve pages with HTTP/1.1
2016-10-29 17:46:57 +02:00
dalf
3e7554422b [mod] the environment variable SEARX_DEBUG can override the general.debug value in settings.yml 2016-10-22 21:36:13 +02:00
Alexandre Flament
a88768efd8 Merge branch 'master' into http1.1 2016-10-22 14:25:50 +02:00
Adam Tauber
d5c0dcd18a [fix] unicode url proxiing 2016-10-17 01:32:31 +02:00
Adam Tauber
1be6e72d51 [enh] add result proxy support - #707 2016-10-17 00:23:15 +02:00
Adam Tauber
19a6ca0b68 [enh] use HMAC for image proxy url verification 2016-10-16 23:41:33 +02:00
Adam Tauber
dceb903114 [mod] disallow search results for robots 2016-10-01 20:22:52 +02:00
Eig8phei
f90eb428c6 serve pages with HTTP/1.1 2016-09-15 14:47:09 +03:00
Adam Tauber
8d4dd3c515 [fix] 404 HTTP status on not found pages - closes #681 2016-09-07 08:32:01 +02:00
Adam Tauber
fa5bc3a563 [fix] use threading to recover after incomplete request crashes - closes #651 #662 2016-09-05 22:46:25 +02:00
Adam Tauber
da4f1c2512 [mod] truncate result content in html - closes #224 2016-09-05 22:22:25 +02:00
Adam Tauber
b4b0231617 [fix] links in new tabs without js ++ noopener bug fix - closes #674 2016-09-04 15:57:43 +02:00
Noemi Vanyi
0056c4035e add custom 404 page 2016-08-24 19:53:09 +02:00
Noemi Vanyi
16a8641649 advanced-search: panel is visible when checked before 2016-07-25 23:30:48 +02:00
Noemi Vanyi
93c0c49e9a add time range search with yahoo 2016-07-25 23:19:46 +02:00
Adam Tauber
21c5fb1c45 [fix] pep8 2016-07-17 00:03:22 +02:00
Adam Tauber
5b5478bbd9 [fix] compute the order of results only once per search 2016-07-16 21:44:28 +02:00
Adam Tauber
485da54961 [mod][fix] use the average of results number ++ do not display smaller result number than the actual result count - closes #600 2016-07-16 21:44:17 +02:00
stepshal
cd9b494cb5 Fix quantity of blank lines after code object. 2016-07-10 21:44:27 +07:00
Adam Tauber
fbbb307f2e [enh] add engine shortcut to config api 2016-07-07 09:27:34 +02:00
Adam Tauber
257e52954a [enh][fix] update to latest dependencies ++ fix tests & travis test runner
WARNING: dependency changes
2016-07-04 22:46:43 +02:00
Adam Tauber
2f7752b410 [enh] display number of results 2016-06-28 00:06:50 +02:00
Noemi Vanyi
d43d9727a3 [enh] add server_settings call - closes #566 2016-06-11 00:20:09 +02:00
Adam Tauber
27218b85fa [fix] missing import 2016-06-07 21:43:24 +02:00
Adam Tauber
bd361e60d8 Revert "use ngettext for plurals" 2016-05-24 12:49:21 +02:00
Dmitry Mikhirev
6d1d8a8f8d use ngettext 2016-05-02 12:36:54 +03:00
Noemi Vanyi
adb1169fa3 add description to a var that seems to be unused 2016-04-09 19:49:59 +02:00
Noemi Vanyi
7daf98933d follow up blocked_engines renaming in templates 2016-04-09 19:49:59 +02:00
Noemi Vanyi
5867e97966 more follow ups in new preferences 2016-04-09 19:49:59 +02:00
Noemi Vanyi
8c4db08443 rename blocked engines to diabled engines 2016-04-09 19:49:59 +02:00
Noemi Vanyi
006841c4ff minor grammar fix in error message 2016-04-09 18:02:12 +02:00
Noemi Vanyi
fe691a0988 new preferences handling
Preferences class was introduced in order to handle user preferences. Right now
it parses cookies and the form in preferences. Also it can retrieve settings
based on the name of the setting.

ATTENTION
Please note that engine preferences are handled differently from now on. So it
introduces incompatible changes. Every user who has saved preferences should reset and
save his/her settings again.

This change was needed, because everytime a default disabled engine was
added saved user preferences would broke. Now engine setting tracking is
fixed.
2016-04-09 01:08:44 +02:00
Adam Tauber
fff9460238 Merge pull request #522 from jibe-b/master
add BASE engine in category "Science"
2016-03-30 11:09:22 +02:00
a01200356
94cb3a7f11 [enh] multilingual autocomplete
implemented for wikipedia, qwant and google
2016-03-29 19:10:13 -06:00
jibe-b
092e15cc1d [enh] Add BASE engine in category Science. Basic and advanced search. 2016-03-29 16:17:17 +02:00
Adam Tauber
0f518e489e [fix] csv results filename encoding 2016-03-16 10:43:28 +01:00
Adam Tauber
bc81eda64b [fix] opensearch image issue - closes #507 2016-03-02 11:52:11 +01:00
Adam Tauber
0fbd705259 [enh] settings option to change instance name - closes #450 2016-02-27 18:23:55 +01:00
Thomas Pointhuber
8bc0f04f4b [fix] typo 2016-01-21 15:57:02 +01:00
Adam Tauber
fab698003f [mod] move wolframalpha to "science" category 2016-01-21 10:45:34 +01:00
Adam Tauber
29dfd9679b [fix] use base_url in http redirects - closes #451 2015-10-23 23:07:36 +02:00
Adam Tauber
b6c3cb0bdd [enh][mod] result handling refactor
Several changes has been made:
 - Parallel result merge
 - Scoring algorithm slightly changed (see result_score())
 - Proper Thread locking on global data manipulation
2015-10-03 17:26:07 +02:00
Adam Tauber
3a8eafcc6b [fix] cookie parameter type 2015-08-12 15:49:48 +02:00
Adam Tauber
43cd8e0c41 [enh] default settings option to safe_search - #396 2015-08-02 20:32:32 +02:00
Adam Tauber
c1d9cfd9ae [enh] default settings option to autocomplete backend - #396 2015-08-02 20:32:32 +02:00
Adam Tauber
1fcf066a81 [mod] change settings file structure according to #314 2015-08-02 20:32:22 +02:00
Adam Tauber
d0830d4edf [enh] add settings option to set listening address - closes #397 2015-08-02 19:03:55 +02:00
Adam Tauber
ff322d3373 [fix] debug message parameter 2015-06-21 16:50:42 +02:00
Adam Tauber
6ef7c3276c [fix] reverse proxy non-root url fix 2015-06-16 19:55:31 +02:00
Thomas Pointhuber
0978f10887 [fix] do not hide categorie inside preferences if there is no engine activated 2015-06-05 08:48:47 +02:00
Alexandre Flament
d4d2dd9cb3 [enh] oscar theme: display engine response times in the preferences 2015-05-30 12:15:23 +02:00
Adam Tauber
18e7d60702 Merge pull request #298 from dalf/ssl
[fix] SSL : SNI support
2015-04-26 13:12:04 -04:00
Alexandre Flament
187617498a Log an error if the ndg-httpsclient, pyopenssl and pyasn1 packages are not installed.
See #298
2015-04-26 18:58:31 +02:00
Adam Tauber
1f0e6ce65b Merge pull request #297 from dalf/proxies
[enh] Implement http proxies for outgoing requests. (see #236)
2015-04-26 12:19:15 -04:00
Adam Tauber
952473d297 Merge pull request #246 from Cqoicebordel/pix-arts
New theme !
2015-04-25 12:52:07 -04:00
Alexandre Flament
83e48fa89b flake8 fix 2015-04-25 12:05:35 +02:00
Alexandre Flament
cde37be4f5 [enh] basic support for http proxy (see #236) 2015-04-25 11:44:53 +02:00
Adam Tauber
d2a636f75d [mod] https rewrite pluginification 2015-04-13 00:30:12 +02:00
Adam Tauber
dd84814b68 [enh] plugins: client side dependency support 2015-04-12 19:24:01 +02:00
Adam Tauber
f59daa4a4b [fix] do not escape empty result content - closes #291 2015-04-12 17:37:01 +02:00
Adam Tauber
b2e026dde2 [mod] remove image proxy requests from the connection pool 2015-04-10 01:10:49 +02:00
Adam Tauber
6f73f4e7a4 [fix] ordered categories in preferences - closes #258 2015-04-07 18:09:38 +02:00
Adam Tauber
1184f45ca5 [enh] reset default preferences 2015-04-07 11:07:48 +02:00