mirror of
https://github.com/searxng/searxng.git
synced 2025-08-01 01:22:22 +02:00
[enh] chrome opensearch support
This commit is contained in:
parent
a2bbf02774
commit
174daf703b
4 changed files with 10 additions and 6 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue