From 4ca0d8cb0fd6c0e6b1301a6e8577aea6d928e9dc Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Mon, 15 Jun 2020 18:25:05 +0200 Subject: [enh] add translatable strings to javascript - closes #461 --- searx/webapp.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 2ba8ccfb8..68be25584 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1021,6 +1021,14 @@ def config(): }) +@app.route('/translations.js') +def js_translations(): + return render( + 'translations.js.tpl', + override_theme='__common__', + ), {'Content-Type': 'text/javascript; charset=UTF-8'} + + @app.errorhandler(404) def page_not_found(e): return render('404.html'), 404 -- cgit v1.2.3 From 08c13daf85311aa1799b8ea9e0990fab058c2b7f Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Thu, 18 Jun 2020 19:37:14 +0200 Subject: [enh] update opensearch.xml to match major search engines opensearch.xml --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 68be25584..35495a0ff 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -949,7 +949,7 @@ def opensearch(): resp = Response(response=ret, status=200, - mimetype="text/xml") + mimetype="application/opensearchdescription+xml") return resp -- cgit v1.2.3 From 4c7b7870044e17167e1f3025bc192a492b908be9 Mon Sep 17 00:00:00 2001 From: Dalf Date: Mon, 22 Jun 2020 13:57:33 +0200 Subject: [mod] don't try to proxify data URL. Previously only image/jpeg was not proxied. This commit don't proxify all MIME types starting with "image/". This is a quick fix for the PR #1985 : the google_image engine can returns some data URL. --- searx/webapp.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 35495a0ff..e1b6bea1c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -335,8 +335,15 @@ def image_proxify(url): if not request.preferences.get_value('image_proxy'): return url - if url.startswith('data:image/jpeg;base64,'): - return url + if url.startswith('data:image/'): + # 50 is an arbitrary number to get only the beginning of the image. + partial_base64 = url[len('data:image/'):50].split(';') + if len(partial_base64) == 2 \ + and partial_base64[0] in ['gif', 'png', 'jpeg', 'pjpeg', 'webp', 'tiff', 'bmp']\ + and partial_base64[1].startswith('base64,'): + return url + else: + return None if settings.get('result_proxy'): return proxify(url) -- cgit v1.2.3