summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2022-07-02 17:18:05 +0200
committerGitHub <noreply@github.com>2022-07-02 17:18:05 +0200
commit4ef62637256d4b2966ff7f0be0051e02d545f756 (patch)
treeb37eb2314f1b51df0d0fe8f63ed1b3cbbcfaa17c
parent8e155b40bc86854b151e152ca4570515eb531e91 (diff)
parentfaf56d4f96ed1afb12ef37980ef382f2ec82fc58 (diff)
downloadsearxng-4ef62637256d4b2966ff7f0be0051e02d545f756.tar.gz
searxng-4ef62637256d4b2966ff7f0be0051e02d545f756.zip
Merge pull request #1404 from dalf/donation_use_external_link
Donation link: default value to searxng.org, can be hidden or custom
-rw-r--r--docs/admin/engines/settings.rst16
-rw-r--r--searx/infopage/en/donate.md3
-rw-r--r--searx/settings.yml18
-rw-r--r--searx/settings_defaults.py1
-rw-r--r--searx/templates/simple/base.html4
-rwxr-xr-xsearx/webapp.py6
6 files changed, 35 insertions, 13 deletions
diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst
index b43802d11..ac0d3b4cc 100644
--- a/docs/admin/engines/settings.rst
+++ b/docs/admin/engines/settings.rst
@@ -70,15 +70,23 @@ Global Settings
.. code:: yaml
general:
- debug: false # Debug mode, only for development
- instance_name: "SearXNG" # displayed name
- privacypolicy_url: false # https://example.com/privacy
- contact_url: false # mailto:contact@example.com
+ debug: false
+ instance_name: "SearXNG"
+ privacypolicy_url: false
+ donation_url: https://docs.searxng.org/donate.html
+ contact_url: false
+ enable_metrics: true
``debug`` : ``$SEARXNG_DEBUG``
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.
+``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``:
Link to privacy policy.
diff --git a/searx/infopage/en/donate.md b/searx/infopage/en/donate.md
deleted file mode 100644
index d2e0dbddb..000000000
--- a/searx/infopage/en/donate.md
+++ /dev/null
@@ -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)
diff --git a/searx/settings.yml b/searx/settings.yml
index 5757a4160..3ecad0df5 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -1,9 +1,17 @@
general:
- debug: false # Debug mode, only for development
- instance_name: "SearXNG" # displayed name
- privacypolicy_url: false # https://example.com/privacy
- contact_url: false # mailto:contact@example.com
- enable_metrics: true # record stats
+ # Debug mode, only for development
+ debug: false
+ # displayed name
+ instance_name: "SearXNG"
+ # 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:
new_issue_url: https://github.com/searxng/searxng/issues/new
diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py
index ccbbbf287..d951624cd 100644
--- a/searx/settings_defaults.py
+++ b/searx/settings_defaults.py
@@ -142,6 +142,7 @@ SCHEMA = {
'instance_name': SettingsValue(str, 'SearXNG'),
'privacypolicy_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),
},
'brand': {
diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index fbb60cc26..b9867c42f 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -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>
{%- endblock -%}
{%- 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 -%}
{%- block linkto_preferences -%}
<a href="{{ url_for('preferences') }}" class="link_on_top_preferences">{{ icon_big('menu-outline') }}<span>{{ _('Preferences') }}</span></a>
diff --git a/searx/webapp.py b/searx/webapp.py
index d4fb1c7dc..151eb5cc6 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -453,6 +453,12 @@ def render(template_name: str, **kwargs):
kwargs['get_setting'] = get_setting
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
kwargs['url_for'] = custom_url_for # override url_for function in templates
kwargs['image_proxify'] = image_proxify