forked from zaclys/searxng
[mod] drop usage of the searx.brand namespace (templates & /config)
In the templates and the /config (JSON) the usage of the 'brand.*' name space is replaced by 'searx.get_setting' function. - new_issue_url --> get_setting('brand.new_issue_url') - brand.GIT_URL --> get_setting('brand.git_url') - brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances') - brand.DOCS_URL --> get_setting('brand.docs_url') - brand.ISSUE_URL --> get_setting('brand.issue_url') - brand.CONTACT_URL --> get_setting('general.contact_url', '') The macro 'new_issue' from searx/templates/*/messages/no_results.html is now imported with context:: {% from '__common__/new_issue.html' import new_issue with context %} To get *public instances URL* from context's 'get_setting()' function:: get_setting('brand.public_instances','') Macro's prototype does no longer need the 'new_issue_url' argument and has been changed to:: macro new_issue(engine_name, engine_reliability) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
c9220de690
commit
3f638ed196
|
@ -11,7 +11,7 @@
|
||||||
<p>More about SearXNG ...</p>
|
<p>More about SearXNG ...</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ brand.GIT_URL }}">github</a></li>
|
<li><a href="{{ get_setting('brand.git_url') }}">SearXNG sources</a></li>
|
||||||
<li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li>
|
<li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
SearXNG is free software, the code is 100% open and you can help to make
|
SearXNG 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>.
|
it better. See more on <a href="{{ get_setting('brand.git_url')
|
||||||
|
}}">SearXNG sources</a>.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -80,10 +81,11 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
SearXNG appreciates your concern regarding logs, so take the code from
|
SearXNG appreciates your concern regarding logs, so take the code from
|
||||||
the <a href="{{ brand.GIT_URL }}">SearXNG project</a> and run it yourself!
|
the <a href="{{ get_setting('brand.git_url') }}">SearXNG project</a> and
|
||||||
|
run it yourself!
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Add your instance to this <a href="{{ brand.PUBLIC_INSTANCES }}"> list of
|
Add your instance to this <a href="{{ get_setting('brand.public_instances') }}"> list of
|
||||||
public instances</a> to help other people reclaim their privacy and make the
|
public instances</a> to help other people reclaim their privacy and make the
|
||||||
Internet freer! The more decentralized the Internet is, the more freedom we
|
Internet freer! The more decentralized the Internet is, the more freedom we
|
||||||
have!
|
have!
|
||||||
|
@ -92,8 +94,8 @@
|
||||||
<h2>Where are the docs & code of this instance?</h2>
|
<h2>Where are the docs & code of this instance?</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
See the <a href="{{ brand.DOCS_URL }}">{{ brand.DOCS_URL }}</a>
|
See the <a href="{{ get_setting('brand.docs_url') }}">SearXNG docs</a>
|
||||||
and <a href="{{ brand.GIT_URL }}">{{ brand.GIT_URL }}</a>
|
and <a href="{{ get_setting('brand.git_url') }}">SearXNG sources</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% macro new_issue(new_issue_url, engine_name, engine_reliability) %}
|
{% macro new_issue(engine_name, engine_reliability) %}
|
||||||
<form action="{{ new_issue_url }}" method="GET">
|
<form action="{{ get_setting('brand.new_issue_url') }}" method="GET">
|
||||||
<input name="title" type="hidden" value="Bug: {{ engine_name }} engine">
|
<input name="title" type="hidden" value="Bug: {{ engine_name }} engine">
|
||||||
<input name="labels" type="hidden" value="bug">
|
<input name="labels" type="hidden" value="bug">
|
||||||
<input name="template" type="hidden" value="bug-report.md">
|
<input name="template" type="hidden" value="bug-report.md">
|
||||||
|
@ -52,6 +52,6 @@ or manually by executing the searx/webapp.py file? -->
|
||||||
{{-'\n '}}* {{ test_name }}: {% for result in results%}`{{ result }}`,{% endfor -%}
|
{{-'\n '}}* {{ test_name }}: {% for result in results%}`{{ result }}`,{% endfor -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</textarea>
|
</textarea>
|
||||||
<button type="submit" class="github-issue-button" title="{{ new_issue_url }}">{{ _('Submit a new issue on Github including the above information') }}</button>
|
<button type="submit" class="github-issue-button" title="{{ get_setting('brand.new_issue_url') }}">{{ _('Submit a new issue on Github including the above information') }}</button>
|
||||||
</form>
|
</form>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
|
@ -82,11 +82,11 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<small>
|
<small>
|
||||||
{{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searxng</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
|
{{ _('Powered by') }} <a href="{{ get_setting('brand.docs_url') }}">SearXNG</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
|
||||||
<a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
|
<a href="{{ get_setting('brand.git_url') }}">{{ _('Source code') }}</a> |
|
||||||
<a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
|
<a href="{{ get_setting('brand.issue_url') }}">{{ _('Issue tracker') }}</a> |
|
||||||
<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>{% if brand.CONTACT_URL %} |
|
<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>{% if get_setting('general.contact_url') %} |
|
||||||
<a href="{{ brand.CONTACT_URL }}">{{ _('Contact instance maintainer') }}</a>{% endif %}
|
<a href="{{ get_setting('general.contact_url') }}">{{ _('Contact instance maintainer') }}</a>{% endif %}
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</a> ){{- '' -}}
|
</a> ){{- '' -}}
|
||||||
</p>
|
</p>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
<p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>)</small></p>
|
<p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>)</small></p>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-info fade in" role="alert">
|
<div class="alert alert-info fade in" role="alert">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'oscar/base.html' %}
|
{% extends 'oscar/base.html' %}
|
||||||
{% from '__common__/new_issue.html' import new_issue %}
|
{% from '__common__/new_issue.html' import new_issue with context %}
|
||||||
|
|
||||||
{% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}
|
{% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
|
{{ new_issue(selected_engine_name, engine_reliabilities[selected_engine_name]) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -51,10 +51,10 @@
|
||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
{{ _('Powered by') }} <a href="{{ url_for('about') }}">searxng</a> - {{ searx_version }} — {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
|
{{ _('Powered by') }} <a href="{{ url_for('about') }}">searxng</a> - {{ searx_version }} — {{ _('a privacy-respecting, hackable metasearch engine') }}<br/>
|
||||||
<a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> |
|
<a href="{{ get_setting('brand.git_url') }}">{{ _('Source code') }}</a> |
|
||||||
<a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> |
|
<a href="{{ get_setting('brand.issue_url') }}">{{ _('Issue tracker') }}</a> |
|
||||||
<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>{% if brand.CONTACT_URL %} |
|
<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>{% if get_setting('general.contact_url') %} |
|
||||||
<a href="{{ brand.CONTACT_URL }}">{{ _('Contact instance maintainer') }}</a>{% endif %}
|
<a href="{{ get_setting('general.contact_url') }}">{{ _('Contact instance maintainer') }}</a>{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
<!--[if gte IE 9]>-->
|
<!--[if gte IE 9]>-->
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</p>
|
</p>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
<p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>) </small></p>
|
<p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>) </small></p>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="dialog-error" role="alert">
|
<div class="dialog-error" role="alert">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% from 'simple/macros.html' import icon %}
|
{% from 'simple/macros.html' import icon %}
|
||||||
{% from '__common__/new_issue.html' import new_issue %}
|
{% from '__common__/new_issue.html' import new_issue with context %}
|
||||||
|
|
||||||
{% extends "simple/base.html" %}
|
{% extends "simple/base.html" %}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
|
{{ new_issue(selected_engine_name, engine_reliabilities[selected_engine_name]) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ from flask_babel import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from searx import logger
|
from searx import logger
|
||||||
from searx import brand
|
from searx import get_setting
|
||||||
from searx import (
|
from searx import (
|
||||||
settings,
|
settings,
|
||||||
searx_debug,
|
searx_debug,
|
||||||
|
@ -473,11 +473,9 @@ def render(template_name, override_theme=None, **kwargs):
|
||||||
kwargs['search_formats'] = [
|
kwargs['search_formats'] = [
|
||||||
x for x in settings['search']['formats'] if x != 'html'
|
x for x in settings['search']['formats'] if x != 'html'
|
||||||
]
|
]
|
||||||
|
kwargs['instance_name'] = get_setting('general.instance_name')
|
||||||
# brand
|
|
||||||
kwargs['instance_name'] = settings['general']['instance_name']
|
|
||||||
kwargs['searx_version'] = VERSION_STRING
|
kwargs['searx_version'] = VERSION_STRING
|
||||||
kwargs['brand'] = brand
|
kwargs['get_setting'] = get_setting
|
||||||
|
|
||||||
# helpers to create links to other pages
|
# helpers to create links to other pages
|
||||||
kwargs['url_for'] = url_for_theme # override url_for function in templates
|
kwargs['url_for'] = url_for_theme # override url_for function in templates
|
||||||
|
@ -1323,9 +1321,9 @@ def config():
|
||||||
'default_theme': settings['ui']['default_theme'],
|
'default_theme': settings['ui']['default_theme'],
|
||||||
'version': VERSION_STRING,
|
'version': VERSION_STRING,
|
||||||
'brand': {
|
'brand': {
|
||||||
'CONTACT_URL': brand.CONTACT_URL,
|
'CONTACT_URL': get_setting('general.contact_url'),
|
||||||
'GIT_URL': brand.GIT_URL,
|
'GIT_URL': get_setting('brand.git_url'),
|
||||||
'DOCS_URL': brand.DOCS_URL
|
'DOCS_URL': get_setting('brand.docs_url'),
|
||||||
},
|
},
|
||||||
'doi_resolvers': list(settings['doi_resolvers'].keys()),
|
'doi_resolvers': list(settings['doi_resolvers'].keys()),
|
||||||
'default_doi_resolver': settings['default_doi_resolver'],
|
'default_doi_resolver': settings['default_doi_resolver'],
|
||||||
|
|
Loading…
Reference in New Issue