Merge pull request #125 from pointhi/versions

[enh] make version of searx readable
This commit is contained in:
Adam Tauber 2014-11-18 13:16:54 +01:00
commit 444416a9ed
8 changed files with 42 additions and 3 deletions

View file

@ -7,6 +7,7 @@ server:
themes_path : "" # Custom ui themes path themes_path : "" # Custom ui themes path
default_theme : default # ui theme default_theme : default # ui theme
https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py 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: engines:
- name : wikipedia - name : wikipedia

View file

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

View file

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

View file

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

View file

@ -3,6 +3,9 @@ from codecs import getincrementalencoder
from HTMLParser import HTMLParser from HTMLParser import HTMLParser
from random import choice from random import choice
from searx.version import VERSION_STRING
from searx import settings
import cStringIO import cStringIO
import csv import csv
import os import os
@ -21,7 +24,8 @@ def gen_useragent():
def searx_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): def highlight_content(content, query):

24
searx/version.py Normal file
View file

@ -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, <asciimoo@gmail.com>
'''
# version of searx
VERSION_MAJOR = 0
VERSION_MINOR = 4
VERSION_BUILD = 0
VERSION_STRING = "%d.%d.%d" % (VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD)

View file

@ -44,6 +44,7 @@ from searx.engines import (
from searx.utils import ( from searx.utils import (
UnicodeWriter, highlight_content, html_to_text, get_themes UnicodeWriter, highlight_content, html_to_text, get_themes
) )
from searx.version import VERSION_STRING
from searx.https_rewrite import https_rules from searx.https_rewrite import https_rules
from searx.languages import language_codes from searx.languages import language_codes
from searx.search import Search from searx.search import Search
@ -171,6 +172,8 @@ def render(template_name, override_theme=None, **kwargs):
if 'autocomplete' not in kwargs: if 'autocomplete' not in kwargs:
kwargs['autocomplete'] = autocomplete kwargs['autocomplete'] = autocomplete
kwargs['searx_version'] = VERSION_STRING
kwargs['method'] = request.cookies.get('method', 'POST') kwargs['method'] = request.cookies.get('method', 'POST')
# override url_for function in templates # override url_for function in templates

View file

@ -6,6 +6,10 @@ from setuptools import find_packages
import os import os
# required to load VERSION_STRING constant
sys.path.insert(0, './searx')
from version import VERSION_STRING
def read(*rnames): def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read() return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
@ -15,7 +19,7 @@ long_description = read('README.rst')
setup( setup(
name='searx', name='searx',
version="0.4.0", version=VERSION_STRING,
description="A privacy-respecting, hackable metasearch engine", description="A privacy-respecting, hackable metasearch engine",
long_description=long_description, long_description=long_description,
classifiers=[ classifiers=[