diff --git a/searx/templates/simple/opensearch.xml b/searx/templates/simple/opensearch.xml index 230f327a..212cecc8 100644 --- a/searx/templates/simple/opensearch.xml +++ b/searx/templates/simple/opensearch.xml @@ -1,22 +1,21 @@ - + {{ instance_name }} - a privacy-respecting, hackable metasearch engine + SearXNG metasearch + SearXNG is a metasearch engine that respects your privacy. UTF-8 - {{ url_for('static', filename='img/favicon.png', _external=True) }} - searx metasearch - {% if opensearch_method == 'get' %} - + {{ url_for('static', filename='img/favicon.png', _external=True) }} + {% if opensearch_method == 'GET' %} + {% else %} - - - + + + {% endif %} {% if autocomplete %} - + {% endif %} - - + + + {{ url_for('search', _external=True) }} diff --git a/searx/webapp.py b/searx/webapp.py index 83bbeac0..eb2b19d4 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1282,19 +1282,17 @@ Disallow: /*?*q=* @app.route('/opensearch.xml', methods=['GET']) def opensearch(): - method = 'post' - - if request.preferences.get_value('method') == 'GET': - method = 'get' + method = request.preferences.get_value('method') + autocomplete = request.preferences.get_value('autocomplete') # chrome/chromium only supports HTTP GET.... if request.headers.get('User-Agent', '').lower().find('webkit') >= 0: - method = 'get' + method = 'GET' - autocomplete = request.preferences.get_value('autocomplete') + if method not in ('POST', 'GET'): + method = 'POST' ret = render('opensearch.xml', opensearch_method=method, autocomplete=autocomplete) - resp = Response(response=ret, status=200, mimetype="application/opensearchdescription+xml") return resp diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 558cc6bb..9f10df90 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -244,7 +244,9 @@ class ViewsTestCase(SearxTestCase): def test_opensearch_xml(self): result = self.app.get('/opensearch.xml') self.assertEqual(result.status_code, 200) - self.assertIn(b'a privacy-respecting, hackable metasearch engine', result.data) + self.assertIn( + b'SearXNG is a metasearch engine that respects your privacy.', result.data + ) def test_favicon(self): result = self.app.get('/favicon.ico')