summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2013-10-20 22:37:55 +0200
committerasciimoo <asciimoo@gmail.com>2013-10-20 22:37:55 +0200
commit174daf703b341455c3320b61034cdb74bee9b55d (patch)
tree96afbdf44f45bb56cb2e2dffb49c3952c7294e64 /searx/webapp.py
parenta2bbf027749a69c0b128de2d52cb288fd6bc4f50 (diff)
[enh] chrome opensearch support
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 517633ac6..fd208504b 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -37,7 +37,7 @@ opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
<Description>Search searx</Description>
<InputEncoding>UTF-8</InputEncoding>
<LongName>searx meta search engine</LongName>
- <Url type="text/html" method="post" template="{host}">
+ <Url type="text/html" method="{method}" template="{host}">
<Param name="q" value="{{searchTerms}}" />
</Url>
</OpenSearchDescription>
@@ -105,7 +105,10 @@ def fav():
@app.route('/opensearch.xml', methods=['GET'])
def opensearch():
global opensearch_xml
- ret = opensearch_xml.format(host=url_for('index', _external=True))
+ method = 'post'
+ if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
+ method = 'get'
+ ret = opensearch_xml.format(method=method, host=url_for('index', _external=True))
resp = Response(response=ret,
status=200,
mimetype="application/xml")