1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-17 18:00:12 +01:00

[enh] chrome opensearch support

This commit is contained in:
asciimoo 2013-10-20 22:37:55 +02:00
parent a2bbf02774
commit 174daf703b
4 changed files with 10 additions and 6 deletions

View File

@ -12,7 +12,7 @@ input { border: 2px solid #666666; color: #444444; padding: 8px; background-col
input[type="checkbox"] { visibility: hidden; } input[type="checkbox"] { visibility: hidden; }
.checkbox_container { display: inline-block; position: relative; margin: 0; padding-left: 3px; margin: 0 10px; } .checkbox_container { display: inline-block; position: relative; padding-left: 3px; margin: 0 10px; }
.checkbox_container label { .checkbox_container label {
cursor: pointer; cursor: pointer;
} }
@ -53,8 +53,9 @@ input[type="checkbox"] { visibility: hidden; }
a { text-decoration: none; } a { text-decoration: none; }
.result_title { margin-bottom: 0; }
.result { margin-bottom: 16px; }
.result_title { margin-bottom: 0; }
.result p { margin-top: 0; padding-top: 0; font-size: 0.8em; max-width: 50em; } .result p { margin-top: 0; padding-top: 0; font-size: 0.8em; max-width: 50em; }
.result h3 { font-size: 0.9em;} .result h3 { font-size: 0.9em;}
.result { max-width: 70em; } .result { max-width: 70em; }

View File

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" /> <meta http-equiv="content-language" content="en" />
<meta name="description" content="Searx - a hackable metasearch engine respecting privacy" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
<meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
<title>searx {% block title %}{% endblock %}</title> <title>searx {% block title %}{% endblock %}</title>
<link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" charset="utf-8" />

View File

@ -1,4 +1,4 @@
<form method="post" action=""> <form method="post" action="/">
<input type="text" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/> <input type="text" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
<input type="submit" value="search" /> <input type="submit" value="search" />
<p> <p>

View File

@ -37,7 +37,7 @@ opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
<Description>Search searx</Description> <Description>Search searx</Description>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
<LongName>searx meta search engine</LongName> <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}}" /> <Param name="q" value="{{searchTerms}}" />
</Url> </Url>
</OpenSearchDescription> </OpenSearchDescription>
@ -105,7 +105,10 @@ def fav():
@app.route('/opensearch.xml', methods=['GET']) @app.route('/opensearch.xml', methods=['GET'])
def opensearch(): def opensearch():
global opensearch_xml 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, resp = Response(response=ret,
status=200, status=200,
mimetype="application/xml") mimetype="application/xml")