소스 검색

[enh] chrome opensearch support

asciimoo 11 년 전
부모
커밋
174daf703b
4개의 변경된 파일10개의 추가작업 그리고 6개의 파일을 삭제
  1. 3
    2
      searx/static/css/style.css
  2. 1
    1
      searx/templates/base.html
  3. 1
    1
      searx/templates/search.html
  4. 5
    2
      searx/webapp.py

+ 3
- 2
searx/static/css/style.css 파일 보기

12
 
12
 
13
 input[type="checkbox"] { visibility: hidden; }
13
 input[type="checkbox"] { visibility: hidden; }
14
 
14
 
15
-.checkbox_container { display: inline-block; position: relative; margin: 0; padding-left: 3px; margin: 0 10px; }
15
+.checkbox_container { display: inline-block; position: relative; padding-left: 3px; margin: 0 10px; }
16
 .checkbox_container label {
16
 .checkbox_container label {
17
     cursor: pointer;
17
     cursor: pointer;
18
 }
18
 }
53
 
53
 
54
 a { text-decoration: none; }
54
 a { text-decoration: none; }
55
 
55
 
56
-.result_title { margin-bottom: 0; }
57
 
56
 
57
+.result { margin-bottom: 16px; }
58
+.result_title { margin-bottom: 0; }
58
 .result p { margin-top: 0; padding-top: 0; font-size: 0.8em; max-width: 50em; }
59
 .result p { margin-top: 0; padding-top: 0; font-size: 0.8em; max-width: 50em; }
59
 .result h3 { font-size: 0.9em;}
60
 .result h3 { font-size: 0.9em;}
60
 .result { max-width: 70em; }
61
 .result { max-width: 70em; }

+ 1
- 1
searx/templates/base.html 파일 보기

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

+ 1
- 1
searx/templates/search.html 파일 보기

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

+ 5
- 2
searx/webapp.py 파일 보기

37
   <Description>Search searx</Description>
37
   <Description>Search searx</Description>
38
   <InputEncoding>UTF-8</InputEncoding>
38
   <InputEncoding>UTF-8</InputEncoding>
39
   <LongName>searx meta search engine</LongName>
39
   <LongName>searx meta search engine</LongName>
40
-  <Url type="text/html" method="post" template="{host}">
40
+  <Url type="text/html" method="{method}" template="{host}">
41
     <Param name="q" value="{{searchTerms}}" />
41
     <Param name="q" value="{{searchTerms}}" />
42
   </Url>
42
   </Url>
43
 </OpenSearchDescription>
43
 </OpenSearchDescription>
105
 @app.route('/opensearch.xml', methods=['GET'])
105
 @app.route('/opensearch.xml', methods=['GET'])
106
 def opensearch():
106
 def opensearch():
107
     global opensearch_xml
107
     global opensearch_xml
108
-    ret = opensearch_xml.format(host=url_for('index', _external=True))
108
+    method = 'post'
109
+    if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
110
+        method = 'get'
111
+    ret = opensearch_xml.format(method=method, host=url_for('index', _external=True))
109
     resp = Response(response=ret,
112
     resp = Response(response=ret,
110
                 status=200,
113
                 status=200,
111
                 mimetype="application/xml")
114
                 mimetype="application/xml")