1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-04 20:30:11 +01:00

[fix] brands: add variables from build env to jinja templating

We have some variables in the build environment which are also needed in the
templating process.  Theses variables are relavant if one creates a fork with
its own branding.  We treat these variables under the term 'brands'.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-03-25 11:49:33 +01:00
parent 9a2f26d915
commit 04c687403e
7 changed files with 29 additions and 19 deletions

View File

@ -71,15 +71,22 @@ $(GH_PAGES)::
# update project files
# --------------------
PHONY += project engines-languages
PHONY += project engines-languages searx.brand
project: searx/data/engines_languages.json
project: searx/data/engines_languages.json searx.brand
searx/data/engines_languages.json: pyenvinstall
engines-languages: pyenvinstall
$(PY_ENV_ACT); python utils/fetch_languages.py
mv engines_languages.json searx/data/engines_languages.json
mv languages.py searx/languages.py
searx.brand:
$(Q)echo "build searx/brand.py"
$(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
$(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
$(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
$(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
# test
# ----

View File

@ -7,7 +7,7 @@
<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>
<li>searx is free software, the code is 100% open and you can help to make it better. See more on <a href="{{ brand.GIT_URL }}">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>
@ -22,14 +22,14 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
<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!
<p>Searx appreciates your concern regarding logs, so take the <a href="{{ brand.GIT_URL }}">code</a> and run it yourself! <br />Add your Searx to this <a href="{{ brand.SEARX_URL }}">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>
<li><a href="https://github.com/asciimoo/searx">github</a></li>
<li><a href="{{ brand.GIT_URL }}">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>
@ -48,13 +48,13 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
<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>
<li>Edit your <a href="{{ brand.GIT_URL }}/blob/master/searx/settings.yml">settings.yml</a></li>
<li>Create your custom engine module, check the <a href="{{ brand.GIT_URL }}/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>
<p>See the <a href="{{ brand.DOCS_URL }}/admin/installation.html#uwsgi">installation and uwsgi setup</a></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>

View File

@ -1,3 +1,3 @@
<a href="https://github.com/asciimoo/searx" class="github">
<a href="{{ brand.GIT_URL }}" 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>
</a>

View File

@ -1,3 +1,3 @@
<a href="https://github.com/asciimoo/searx" class="github">
<a href="{{ brand.GIT_URL }}" 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>

View File

@ -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.GIT_URL }}/issues">{{ _('Issue tracker') }}</a> |
<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
</small>
</p>
</div>

View File

@ -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.GIT_URL }}/issues">{{ _('Issue tracker') }}</a> |
<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>
</p>
</footer>
<!--[if gte IE 9]>-->

3
searx/webapp.py Normal file → Executable file
View File

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