on master help sign in
[enh] make version of searx readable
commitaba65369d2d55b337939d004b06d6ff10f8519b9 authorThomas Pointhuber <thomas.pointhuber@gmx.at> dateTue 18 Nov 2014, 11:37 (12 years ago) parentb1234ee
8 files changed+42−3
searx/settings.yml+1 searx/templates/courgette/base.html+1 searx/templates/default/base.html+1 searx/templates/oscar/base.html+2−1 searx/utils.py+5−1 searx/version.py+24 searx/webapp.py+3 setup.py+5−1
searx/settings.yml+1
@@ -7,6 +7,7 @@ server:
77 themes_path : "" # Custom ui themes path
88 default_theme : default # ui theme
99 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
1011
1112engines:
1213 - name : wikipedia
searx/templates/courgette/base.html+1
@@ -4,6 +4,7 @@
44 <meta charset="UTF-8" />
55 <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
66 <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7+ <meta name="generator" content="searx/{{ searx_version }}">
78 <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
89 <title>{% block title %}{% endblock %}searx</title>
910 <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
searx/templates/default/base.html+1
@@ -4,6 +4,7 @@
44 <meta charset="UTF-8" />
55 <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
66 <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7+ <meta name="generator" content="searx/{{ searx_version }}">
78 <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
89 <title>{% block title %}{% endblock %}searx</title>
910 <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
searx/templates/oscar/base.html+2−1
@@ -5,6 +5,7 @@
55 <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
66 <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
77 <meta http-equiv="X-UA-Compatible" content="IE=edge">
8+ <meta name="generator" content="searx/{{ searx_version }}">
89 <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
910 <title>{% block title %}{% endblock %}searx</title>
1011
@@ -64,7 +65,7 @@
6465 <div class="container">
6566 {% block footer %}
6667 {% 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>
6869 </div>
6970 </div>
7071 <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
searx/utils.py+5−1
@@ -3,6 +3,9 @@ from codecs import getincrementalencoder
33from HTMLParser import HTMLParser
44from random import choice
55
6+from searx.version import VERSION_STRING
7+from searx import settings
8+
69import cStringIO
710import csv
811import os
@@ -21,7 +24,8 @@ def gen_useragent():
2124
2225
2326def searx_useragent():
24− return 'searx'
27+ return 'searx/{searx_version} {suffix}'.format(searx_version=VERSION_STRING,
28+ suffix=settings['server'].get('useragent_suffix', ''))
2529
2630
2731def highlight_content(content, query):
searx/version.pynew file+24
@@ -0,0 +1,24 @@
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)
searx/webapp.py+3
@@ -44,6 +44,7 @@ from searx.engines import (
4444from searx.utils import (
4545 UnicodeWriter, highlight_content, html_to_text, get_themes
4646)
47+from searx.version import VERSION_STRING
4748from searx.https_rewrite import https_rules
4849from searx.languages import language_codes
4950from searx.search import Search
@@ -171,6 +172,8 @@ def render(template_name, override_theme=None, **kwargs):
171172 if 'autocomplete' not in kwargs:
172173 kwargs['autocomplete'] = autocomplete
173174
175+ kwargs['searx_version'] = VERSION_STRING
176+
174177 kwargs['method'] = request.cookies.get('method', 'POST')
175178
176179 # override url_for function in templates
setup.py+5−1
@@ -6,6 +6,10 @@ from setuptools import find_packages
66
77import os
88
9+# required to load VERSION_STRING constant
10+sys.path.insert(0, './searx')
11+from version import VERSION_STRING
12+
913
1014def read(*rnames):
1115 return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
@@ -15,7 +19,7 @@ long_description = read('README.rst')
1519
1620setup(
1721 name='searx',
18− version="0.4.0",
22+ version=VERSION_STRING,
1923 description="A privacy-respecting, hackable metasearch engine",
2024 long_description=long_description,
2125 classifiers=[