Przeglądaj źródła

[enh] make version of searx readable

Thomas Pointhuber 10 lat temu
rodzic
commit
aba65369d2

+ 1
- 0
searx/settings.yml Wyświetl plik

@@ -7,6 +7,7 @@ server:
7 7
     themes_path : "" # Custom ui themes path
8 8
     default_theme : default # ui theme
9 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 12
 engines:
12 13
   - name : wikipedia

+ 1
- 0
searx/templates/courgette/base.html Wyświetl plik

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

+ 1
- 0
searx/templates/default/base.html Wyświetl plik

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

+ 2
- 1
searx/templates/oscar/base.html Wyświetl plik

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

+ 5
- 1
searx/utils.py Wyświetl plik

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

+ 24
- 0
searx/version.py Wyświetl plik

@@ -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)

+ 3
- 0
searx/webapp.py Wyświetl plik

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

+ 5
- 1
setup.py Wyświetl plik

@@ -6,6 +6,10 @@ from setuptools import find_packages
6 6
 
7 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 14
 def read(*rnames):
11 15
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
@@ -15,7 +19,7 @@ long_description = read('README.rst')
15 19
 
16 20
 setup(
17 21
     name='searx',
18
-    version="0.4.0",
22
+    version=VERSION_STRING,
19 23
     description="A privacy-respecting, hackable metasearch engine",
20 24
     long_description=long_description,
21 25
     classifiers=[