Browse Source

[enh] make version of searx readable

Thomas Pointhuber 10 years ago
parent
commit
aba65369d2

+ 1
- 0
searx/settings.yml View File

7
     themes_path : "" # Custom ui themes path
7
     themes_path : "" # Custom ui themes path
8
     default_theme : default # ui theme
8
     default_theme : default # ui theme
9
     https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py
9
     https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py
10
+    useragent_suffix : "" # suffix of searx_useragent, could contain informations like an email address to the administrator
10
 
11
 
11
 engines:
12
 engines:
12
   - name : wikipedia
13
   - name : wikipedia

+ 1
- 0
searx/templates/courgette/base.html View File

4
     <meta charset="UTF-8" />
4
     <meta charset="UTF-8" />
5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
+    <meta name="generator" content="searx/{{ searx_version }}">
7
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8
     <title>{% block title %}{% endblock %}searx</title>
9
     <title>{% block title %}{% endblock %}searx</title>
9
     <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
10
     <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />

+ 1
- 0
searx/templates/default/base.html View File

4
     <meta charset="UTF-8" />
4
     <meta charset="UTF-8" />
5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
+    <meta name="generator" content="searx/{{ searx_version }}">
7
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8
     <title>{% block title %}{% endblock %}searx</title>
9
     <title>{% block title %}{% endblock %}searx</title>
9
     <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
10
     <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />

+ 2
- 1
searx/templates/oscar/base.html View File

5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
5
     <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
8
+    <meta name="generator" content="searx/{{ searx_version }}">
8
     <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
9
     <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
9
     <title>{% block title %}{% endblock %}searx</title>
10
     <title>{% block title %}{% endblock %}searx</title>
10
     
11
     
64
         <div class="container">
65
         <div class="container">
65
             {% block footer %}
66
             {% block footer %}
66
             {% endblock %}
67
             {% endblock %}
67
-            <p class="text-muted">{{ _('Powered by') }} <a href="https://github.com/asciimoo/searx">Searx</a> - {{ _('a privacy-respecting, hackable metasearch engine') }}</p>
68
+            <p class="text-muted">{{ _('Powered by') }} <a href="https://github.com/asciimoo/searx">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}</p>
68
         </div>
69
         </div>
69
     </div>
70
     </div>
70
     <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
71
     <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>

+ 5
- 1
searx/utils.py View File

3
 from HTMLParser import HTMLParser
3
 from HTMLParser import HTMLParser
4
 from random import choice
4
 from random import choice
5
 
5
 
6
+from searx.version import VERSION_STRING
7
+from searx import settings
8
+
6
 import cStringIO
9
 import cStringIO
7
 import csv
10
 import csv
8
 import os
11
 import os
21
 
24
 
22
 
25
 
23
 def searx_useragent():
26
 def searx_useragent():
24
-    return 'searx'
27
+    return 'searx/{searx_version} {suffix}'.format(searx_version=VERSION_STRING,
28
+                                          suffix=settings['server'].get('useragent_suffix', ''))
25
 
29
 
26
 
30
 
27
 def highlight_content(content, query):
31
 def highlight_content(content, query):

+ 24
- 0
searx/version.py View File

1
+# -*- coding: utf-8 -*-
2
+'''
3
+searx is free software: you can redistribute it and/or modify
4
+it under the terms of the GNU Affero General Public License as published by
5
+the Free Software Foundation, either version 3 of the License, or
6
+(at your option) any later version.
7
+
8
+searx is distributed in the hope that it will be useful,
9
+but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
+GNU Affero General Public License for more details.
12
+
13
+You should have received a copy of the GNU Affero General Public License
14
+along with searx. If not, see < http://www.gnu.org/licenses/ >.
15
+
16
+(C) 2013- by Adam Tauber, <asciimoo@gmail.com>
17
+'''
18
+
19
+# version of searx
20
+VERSION_MAJOR = 0
21
+VERSION_MINOR = 4
22
+VERSION_BUILD = 0
23
+
24
+VERSION_STRING = "%d.%d.%d" % (VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD)

+ 3
- 0
searx/webapp.py View File

44
 from searx.utils import (
44
 from searx.utils import (
45
     UnicodeWriter, highlight_content, html_to_text, get_themes
45
     UnicodeWriter, highlight_content, html_to_text, get_themes
46
 )
46
 )
47
+from searx.version import VERSION_STRING
47
 from searx.https_rewrite import https_rules
48
 from searx.https_rewrite import https_rules
48
 from searx.languages import language_codes
49
 from searx.languages import language_codes
49
 from searx.search import Search
50
 from searx.search import Search
171
     if 'autocomplete' not in kwargs:
172
     if 'autocomplete' not in kwargs:
172
         kwargs['autocomplete'] = autocomplete
173
         kwargs['autocomplete'] = autocomplete
173
 
174
 
175
+    kwargs['searx_version'] = VERSION_STRING
176
+
174
     kwargs['method'] = request.cookies.get('method', 'POST')
177
     kwargs['method'] = request.cookies.get('method', 'POST')
175
 
178
 
176
     # override url_for function in templates
179
     # override url_for function in templates

+ 5
- 1
setup.py View File

6
 
6
 
7
 import os
7
 import os
8
 
8
 
9
+# required to load VERSION_STRING constant
10
+sys.path.insert(0, './searx')
11
+from version import VERSION_STRING
12
+
9
 
13
 
10
 def read(*rnames):
14
 def read(*rnames):
11
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
15
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
15
 
19
 
16
 setup(
20
 setup(
17
     name='searx',
21
     name='searx',
18
-    version="0.4.0",
22
+    version=VERSION_STRING,
19
     description="A privacy-respecting, hackable metasearch engine",
23
     description="A privacy-respecting, hackable metasearch engine",
20
     long_description=long_description,
24
     long_description=long_description,
21
     classifiers=[
25
     classifiers=[