1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Merge pull request #1404 from dalf/donation_use_external_link

Donation link: default value to searxng.org, can be hidden or custom
This commit is contained in:
Markus Heiser 2022-07-02 17:18:05 +02:00 committed by GitHub
commit 4ef6263725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 13 deletions

View File

@ -70,15 +70,23 @@ Global Settings
.. code:: yaml .. code:: yaml
general: general:
debug: false # Debug mode, only for development debug: false
instance_name: "SearXNG" # displayed name instance_name: "SearXNG"
privacypolicy_url: false # https://example.com/privacy privacypolicy_url: false
contact_url: false # mailto:contact@example.com donation_url: https://docs.searxng.org/donate.html
contact_url: false
enable_metrics: true
``debug`` : ``$SEARXNG_DEBUG`` ``debug`` : ``$SEARXNG_DEBUG``
Allow a more detailed log if you run SearXNG directly. Display *detailed* error Allow a more detailed log if you run SearXNG directly. Display *detailed* error
messages in the browser too, so this must be deactivated in production. messages in the browser too, so this must be deactivated in production.
``donation_url`` :
At default the donation link points to the `SearXNG project
<https://docs.searxng.org/donate.html>`_. Set value to ``true`` to use your
own donation page written in the :ref:`searx/info/en/donate.md
<searx.infopage>` and use ``false`` to disable the donation link altogether.
``privacypolicy_url``: ``privacypolicy_url``:
Link to privacy policy. Link to privacy policy.

View File

@ -1,3 +0,0 @@
# Donate to searxng.org
You can support the SearXNG project by clicking on the donation page: [https://docs.searxng.org/donate.html](https://docs.searxng.org/donate.html)

View File

@ -1,9 +1,17 @@
general: general:
debug: false # Debug mode, only for development # Debug mode, only for development
instance_name: "SearXNG" # displayed name debug: false
privacypolicy_url: false # https://example.com/privacy # displayed name
contact_url: false # mailto:contact@example.com instance_name: "SearXNG"
enable_metrics: true # record stats # For example: https://example.com/privacy
privacypolicy_url: false
# use true to use your own donation page written in searx/info/en/donate.md
# use false to disable the donation link
donation_url: https://docs.searxng.org/donate.html
# mailto:contact@example.com
contact_url: false
# record stats
enable_metrics: true
brand: brand:
new_issue_url: https://github.com/searxng/searxng/issues/new new_issue_url: https://github.com/searxng/searxng/issues/new

View File

@ -142,6 +142,7 @@ SCHEMA = {
'instance_name': SettingsValue(str, 'SearXNG'), 'instance_name': SettingsValue(str, 'SearXNG'),
'privacypolicy_url': SettingsValue((None, False, str), None), 'privacypolicy_url': SettingsValue((None, False, str), None),
'contact_url': SettingsValue((None, False, str), None), 'contact_url': SettingsValue((None, False, str), None),
'donation_url': SettingsValue((bool, str), "https://docs.searxng.org/donate.html"),
'enable_metrics': SettingsValue(bool, True), 'enable_metrics': SettingsValue(bool, True),
}, },
'brand': { 'brand': {

View File

@ -46,7 +46,9 @@
<a href="{{ url_for('info', pagename='about') }}" class="link_on_top_about">{{ icon_big('information-circle-outline') }}<span>{{ _('About') }}</span></a> <a href="{{ url_for('info', pagename='about') }}" class="link_on_top_about">{{ icon_big('information-circle-outline') }}<span>{{ _('About') }}</span></a>
{%- endblock -%} {%- endblock -%}
{%- block linkto_donate -%} {%- block linkto_donate -%}
<a href="{{ url_for('info', pagename='donate') }}" class="link_on_top_donate">{{ icon_big('heart-outline') }}<span>{{ _('Donate') }}</span></a> {%- if donation_url -%}
<a href="{{ donation_url }}" class="link_on_top_donate">{{ icon_big('heart-outline') }}<span>{{ _('Donate') }}</span></a>
{%- endif -%}
{%- endblock -%} {%- endblock -%}
{%- block linkto_preferences -%} {%- block linkto_preferences -%}
<a href="{{ url_for('preferences') }}" class="link_on_top_preferences">{{ icon_big('menu-outline') }}<span>{{ _('Preferences') }}</span></a> <a href="{{ url_for('preferences') }}" class="link_on_top_preferences">{{ icon_big('menu-outline') }}<span>{{ _('Preferences') }}</span></a>

View File

@ -453,6 +453,12 @@ def render(template_name: str, **kwargs):
kwargs['get_setting'] = get_setting kwargs['get_setting'] = get_setting
kwargs['get_pretty_url'] = get_pretty_url kwargs['get_pretty_url'] = get_pretty_url
# values from settings: donation_url
donation_url = get_setting('general.donation_url')
if donation_url is True:
donation_url = custom_url_for('info', pagename='donate')
kwargs['donation_url'] = donation_url
# helpers to create links to other pages # helpers to create links to other pages
kwargs['url_for'] = custom_url_for # override url_for function in templates kwargs['url_for'] = custom_url_for # override url_for function in templates
kwargs['image_proxify'] = image_proxify kwargs['image_proxify'] = image_proxify