diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2020-03-30 14:51:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 14:51:40 +0000 |
commit | 949378a07f7baa7ded50f15b386a72e5cd687006 (patch) | |
tree | a38e004d304de0b2480b50bd36c3f521fbf08546 /searx | |
parent | 9a2f26d915ee05d933a18c31bca2121658aa7ffd (diff) | |
parent | 1ae39787c1d19a6781ad3d5cb0b2615741d9eb4b (diff) | |
download | searxng-949378a07f7baa7ded50f15b386a72e5cd687006.tar.gz searxng-949378a07f7baa7ded50f15b386a72e5cd687006.zip |
Merge pull request #1900 from return42/issue-1898
export build variables / support brands
Diffstat (limited to 'searx')
-rw-r--r-- | searx/brand.py | 5 | ||||
-rw-r--r-- | searx/data/useragents.json | 9 | ||||
-rw-r--r-- | searx/static/themes/oscar/.gitignore | 2 | ||||
-rw-r--r-- | searx/static/themes/oscar/gruntfile.js | 4 | ||||
-rw-r--r-- | searx/static/themes/simple/.gitignore | 1 | ||||
-rw-r--r-- | searx/static/themes/simple/gruntfile.js | 6 | ||||
-rw-r--r-- | searx/templates/__common__/about.html | 138 | ||||
-rw-r--r-- | searx/templates/courgette/github_ribbon.html | 2 | ||||
-rw-r--r-- | searx/templates/oscar/base.html | 8 | ||||
-rw-r--r-- | searx/templates/simple/base.html | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | searx/webapp.py | 76 |
11 files changed, 156 insertions, 101 deletions
diff --git a/searx/brand.py b/searx/brand.py new file mode 100644 index 000000000..d563447f6 --- /dev/null +++ b/searx/brand.py @@ -0,0 +1,5 @@ +GIT_URL = 'https://github.com/asciimoo/searx' +ISSUE_URL = 'https://github.com/asciimoo/searx/issues' +SEARX_URL = 'https://searx.me' +DOCS_URL = 'https://asciimoo.github.io/searx' +PUBLIC_INSTANCES = 'https://searx.space' diff --git a/searx/data/useragents.json b/searx/data/useragents.json index abb81000c..5ba8c5be8 100644 --- a/searx/data/useragents.json +++ b/searx/data/useragents.json @@ -1,11 +1,8 @@ { "versions": [ - "70.0.1", - "70.0", - "69.0.3", - "69.0.2", - "69.0.1", - "69.0" + "74.0", + "73.0.1", + "73.0" ], "os": [ "Windows NT 10; WOW64", diff --git a/searx/static/themes/oscar/.gitignore b/searx/static/themes/oscar/.gitignore index c2658d7d1..07e6e472c 100644 --- a/searx/static/themes/oscar/.gitignore +++ b/searx/static/themes/oscar/.gitignore @@ -1 +1 @@ -node_modules/ +/node_modules diff --git a/searx/static/themes/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js index def035dba..606b6bcfb 100644 --- a/searx/static/themes/oscar/gruntfile.js +++ b/searx/static/themes/oscar/gruntfile.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, dist: { files: { @@ -38,7 +38,6 @@ module.exports = function(grunt) { development: { options: { paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"] - //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' }, files: {"css/pointhi.css": "less/pointhi/oscar.less", "css/logicodev.css": "less/logicodev-dark/oscar.less", @@ -47,7 +46,6 @@ module.exports = function(grunt) { production: { options: { paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"], - //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', cleancss: true }, files: {"css/pointhi.min.css": "less/pointhi/oscar.less", diff --git a/searx/static/themes/simple/.gitignore b/searx/static/themes/simple/.gitignore new file mode 100644 index 000000000..07e6e472c --- /dev/null +++ b/searx/static/themes/simple/.gitignore @@ -0,0 +1 @@ +/node_modules diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index c372ec730..c8f2ed3c6 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -36,7 +36,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', + banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n', output: { comments: 'some' }, @@ -57,7 +57,7 @@ module.exports = function(grunt) { development: { options: { paths: ["less"], - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, files: { "css/searx.css": "less/style.less", @@ -73,7 +73,7 @@ module.exports = function(grunt) { compatibility: '*' }) ], - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, files: { "css/searx.min.css": "less/style.less", diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html index ff86ddd28..5c91c3394 100644 --- a/searx/templates/__common__/about.html +++ b/searx/templates/__common__/about.html @@ -1,63 +1,97 @@ <div{% if rtl %} dir="ltr"{% endif %}> - <h1>About <a href="{{ url_for('index') }}">searx</a></h1> + <h1>About <a href="{{ url_for('index') }}">searx</a></h1> - <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users. - </p> - <h2>Why use searx?</h2> - <ul> - <li>searx may not offer you as personalised results as Google, but it doesn't generate a profile about you</li> - <li>searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you</li> - <li>searx is free software, the code is 100% open and you can help to make it better. See more on <a href="https://github.com/asciimoo/searx">github</a></li> - </ul> - <p>If you do care about privacy, want to be a conscious user, or otherwise believe - in digital freedom, make searx your default search engine or run it on your own server</p> + <p> + Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, + aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> + while not storing information about its users. + </p> -<h2>Technical details - How does it work?</h2> + <p>More about searx ...</p> -<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, -inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.<br /> -It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, searx uses the search bar to perform GET requests.<br /> -Searx can be added to your browser's search bar; moreover, it can be set as the default search engine. -</p> - -<h2>How can I make it my own?</h2> - -<p>Searx appreciates your concern regarding logs, so take the <a href="https://github.com/asciimoo/searx">code</a> and run it yourself! <br />Add your Searx to this <a href="https://searx.space/">list</a> to help other people reclaim their privacy and make the Internet freer! -<br />The more decentralized the Internet is, the more freedom we have!</p> - - -<h2>More about searx</h2> - -<ul> + <ul> <li><a href="https://github.com/asciimoo/searx">github</a></li> - <li><a href="https://www.ohloh.net/p/searx/">ohloh</a></li> <li><a href="https://twitter.com/Searx_engine">twitter</a></li> <li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li> <li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li> -</ul> - - -<hr /> - -<h2 id="faq">FAQ</h2> - -<h3>How to add to firefox?</h3> -<p><a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a> searx as a search engine on any version of Firefox! (javascript required)</p> - -<h2 id="dev_faq">Developer FAQ</h2> - -<h3>New engines?</h3> -<ul> - <li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li> - <li>Create your custom engine module, check the <a href="https://github.com/asciimoo/searx/blob/master/examples/basic_engine.py">example engine</a></li> -</ul> -<p>Don't forget to restart searx after config edit!</p> - -<h3>Installation/WSGI support?</h3> -<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p> - -<h3>How to debug engines?</h3> -<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p> + </ul> + + <hr /> + + <h2>Why use searx?</h2> + + <ul> + <li> + Searx may not offer you as personalised results as Google, but it doesn't + generate a profile about you. + </li> + <li> + Searx doesn't care about what you search for, never shares anything with a + third party, and it can't be used to compromise you. + </li> + <li> + Searx is free software, the code is 100% open and you can help to make it + better. See more on <a href="https://github.com/asciimoo/searx">github</a>. + </li> + </ul> + + <p> + If you do care about privacy, want to be a conscious user, or otherwise + believe in digital freedom, make searx your default search engine or run it + on your own server + </p> + + <h2>Technical details - How does it work?</h2> + + <p> + Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, + inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>. + + It provides basic privacy by mixing your queries with searches on other + platforms without storing search data. Queries are made using a POST request + on every browser (except chrome*). Therefore they show up in neither our + logs, nor your url history. In case of Chrome* users there is an exception, + searx uses the search bar to perform GET requests. + + Searx can be added to your browser's search bar; moreover, it can be set as + the default search engine. + </p> + + <h2 id='add to browser'>How to set as the default search engine?</h2> + + <dt>Firefox</dt> + + <dd> + <a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a> + searx as a search engine on any version of Firefox! (javascript required) + </dd> + + <h2>Where to find anonymous usage statistics of this instance ?</h2> + + <p> + <a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used. + </p> + + <h2>How can I make it my own?</h2> + + <p> + Searx appreciates your concern regarding logs, so take the + code from the <a href="https://github.com/asciimoo/searx">orgin searx project</a> and + run it yourself! + </p> + <p> + Add your searx instance to this <a href="{{ brand.PUBLIC_INSTANCES }}"> list + of public searx instances</a> to help other people reclaim their privacy and + make the Internet freer! The more decentralized the Internet is, the more + freedom we have! + </p> + + <h2>Where are the docs & code of this instance?</h2> + + <p> + See the <a href="{{ brand.DOCS_URL }}">{{ brand.DOCS_URL }}</a> + and <a href="{{ brand.GIT_URL }}">{{ brand.GIT_URL }}</a> + </p> </div> {% include "__common__/aboutextend.html" ignore missing %} diff --git a/searx/templates/courgette/github_ribbon.html b/searx/templates/courgette/github_ribbon.html index 67c6e678f..bdd9cf180 100644 --- a/searx/templates/courgette/github_ribbon.html +++ b/searx/templates/courgette/github_ribbon.html @@ -1,3 +1,3 @@ <a href="https://github.com/asciimoo/searx" class="github"> <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub" class="github"/> -</a>
\ No newline at end of file +</a> diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 9465ca58a..5eb4462e4 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -85,10 +85,10 @@ {% endblock %} <p class="text-muted"> <small> - {{ _('Powered by') }} <a href="https://asciimoo.github.io/searx/">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> - <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | - <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://searx.space/">{{ _('Public instances') }}</a> + {{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a> </small> </p> </div> diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index bba02dbf8..71df123ea 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -51,9 +51,9 @@ <footer> <p> {{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> - <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | - <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://searx.space/">{{ _('Public instances') }}</a> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a> </p> </footer> <!--[if gte IE 9]>--> diff --git a/searx/webapp.py b/searx/webapp.py index b3928921e..c910230ab 100644..100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -57,6 +57,7 @@ from babel.support import Translations import flask_babel from flask_babel import Babel, gettext, format_date, format_decimal from flask.json import jsonify +from searx import brand from searx import settings, searx_dir, searx_debug from searx.exceptions import SearxParameterException from searx.engines import ( @@ -427,6 +428,8 @@ def render(template_name, override_theme=None, **kwargs): kwargs['preferences'] = request.preferences + kwargs['brand'] = brand + kwargs['scripts'] = set() for plugin in request.user_plugins: for script in plugin.js_dependencies: @@ -955,34 +958,51 @@ def clear_cookies(): @app.route('/config') def config(): - return jsonify({'categories': list(categories.keys()), - 'engines': [{'name': name, - 'categories': engine.categories, - 'shortcut': engine.shortcut, - 'enabled': not engine.disabled, - 'paging': engine.paging, - 'language_support': engine.language_support, - 'supported_languages': - list(engine.supported_languages.keys()) - if isinstance(engine.supported_languages, dict) - else engine.supported_languages, - 'safesearch': engine.safesearch, - 'time_range_support': engine.time_range_support, - 'timeout': engine.timeout} - for name, engine in engines.items() if request.preferences.validate_token(engine)], - 'plugins': [{'name': plugin.name, - 'enabled': plugin.default_on} - for plugin in plugins], - 'instance_name': settings['general']['instance_name'], - 'locales': settings['locales'], - 'default_locale': settings['ui']['default_locale'], - 'autocomplete': settings['search']['autocomplete'], - 'safe_search': settings['search']['safe_search'], - 'default_theme': settings['ui']['default_theme'], - 'version': VERSION_STRING, - 'doi_resolvers': [r for r in settings['doi_resolvers']], - 'default_doi_resolver': settings['default_doi_resolver'], - }) + """Return configuration in JSON format.""" + _engines = [] + for name, engine in engines.items(): + if not request.preferences.validate_token(engine): + continue + + supported_languages = engine.supported_languages + if isinstance(engine.supported_languages, dict): + supported_languages = list(engine.supported_languages.keys()) + + _engines.append({ + 'name': name, + 'categories': engine.categories, + 'shortcut': engine.shortcut, + 'enabled': not engine.disabled, + 'paging': engine.paging, + 'language_support': engine.language_support, + 'supported_languages': supported_languages, + 'safesearch': engine.safesearch, + 'time_range_support': engine.time_range_support, + 'timeout': engine.timeout + }) + + _plugins = [] + for _ in plugins: + _plugins.append({'name': _.name, 'enabled': _.default_on}) + + return jsonify({ + 'categories': list(categories.keys()), + 'engines': _engines, + 'plugins': _plugins, + 'instance_name': settings['general']['instance_name'], + 'locales': settings['locales'], + 'default_locale': settings['ui']['default_locale'], + 'autocomplete': settings['search']['autocomplete'], + 'safe_search': settings['search']['safe_search'], + 'default_theme': settings['ui']['default_theme'], + 'version': VERSION_STRING, + 'brand': { + 'GIT_URL': brand.GIT_URL, + 'DOCS_URL': brand.DOCS_URL + }, + 'doi_resolvers': [r for r in settings['doi_resolvers']], + 'default_doi_resolver': settings['default_doi_resolver'], + }) @app.errorhandler(404) |