diff --git a/searx/settings.yml b/searx/settings.yml index c4589a0a..d64a23bf 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -7,6 +7,7 @@ server: themes_path : "" # Custom ui themes path default_theme : default # ui theme https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py + useragent_suffix : "" # suffix of searx_useragent, could contain informations like an email address to the administrator engines: - name : wikipedia diff --git a/searx/templates/courgette/base.html b/searx/templates/courgette/base.html index da5ae905..382b8d5e 100644 --- a/searx/templates/courgette/base.html +++ b/searx/templates/courgette/base.html @@ -4,6 +4,7 @@ + {% block title %}{% endblock %}searx diff --git a/searx/templates/default/base.html b/searx/templates/default/base.html index c231bf8c..bc7f0972 100644 --- a/searx/templates/default/base.html +++ b/searx/templates/default/base.html @@ -4,6 +4,7 @@ + {% block title %}{% endblock %}searx diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index a023db41..807da84e 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -5,6 +5,7 @@ + {% block title %}{% endblock %}searx @@ -64,7 +65,7 @@
{% block footer %} {% endblock %} -

{{ _('Powered by') }} Searx - {{ _('a privacy-respecting, hackable metasearch engine') }}

+

{{ _('Powered by') }} searx - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}

diff --git a/searx/utils.py b/searx/utils.py index 7764291f..47980bd3 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -3,6 +3,9 @@ from codecs import getincrementalencoder from HTMLParser import HTMLParser from random import choice +from searx.version import VERSION_STRING +from searx import settings + import cStringIO import csv import os @@ -21,7 +24,8 @@ def gen_useragent(): def searx_useragent(): - return 'searx' + return 'searx/{searx_version} {suffix}'.format(searx_version=VERSION_STRING, + suffix=settings['server'].get('useragent_suffix', '')) def highlight_content(content, query): diff --git a/searx/version.py b/searx/version.py new file mode 100644 index 00000000..8127d853 --- /dev/null +++ b/searx/version.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +''' +searx is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +searx is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with searx. If not, see < http://www.gnu.org/licenses/ >. + +(C) 2013- by Adam Tauber, +''' + +# version of searx +VERSION_MAJOR = 0 +VERSION_MINOR = 4 +VERSION_BUILD = 0 + +VERSION_STRING = "%d.%d.%d" % (VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD) diff --git a/searx/webapp.py b/searx/webapp.py index e25a4067..332415e6 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -44,6 +44,7 @@ from searx.engines import ( from searx.utils import ( UnicodeWriter, highlight_content, html_to_text, get_themes ) +from searx.version import VERSION_STRING from searx.https_rewrite import https_rules from searx.languages import language_codes from searx.search import Search @@ -171,6 +172,8 @@ def render(template_name, override_theme=None, **kwargs): if 'autocomplete' not in kwargs: kwargs['autocomplete'] = autocomplete + kwargs['searx_version'] = VERSION_STRING + kwargs['method'] = request.cookies.get('method', 'POST') # override url_for function in templates diff --git a/setup.py b/setup.py index da3d1b6a..3e52e18d 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,10 @@ from setuptools import find_packages import os +# required to load VERSION_STRING constant +sys.path.insert(0, './searx') +from version import VERSION_STRING + def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() @@ -15,7 +19,7 @@ long_description = read('README.rst') setup( name='searx', - version="0.4.0", + version=VERSION_STRING, description="A privacy-respecting, hackable metasearch engine", long_description=long_description, classifiers=[