From 31005595c9681fbcc75d5d933c3cac1300a22e75 Mon Sep 17 00:00:00 2001 From: samsaptidev Date: Wed, 15 Jun 2022 22:06:52 +0200 Subject: [PATCH] Add privacypolicy_url option --- AUTHORS.rst | 1 + docs/admin/engines/settings.rst | 4 ++++ docs/conf.py | 3 +++ searx/settings.yml | 1 + searx/settings_defaults.py | 1 + searx/templates/simple/base.html | 9 +++++++-- searx/webapp.py | 1 + 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 0239346a..e9ed45dc 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -163,3 +163,4 @@ features or generally made searx better: - @xenrox - @OliveiraHermogenes - Paul Alcock @Guilvareux +- Sam A. ``_ diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst index 8f4ee12d..b43802d1 100644 --- a/docs/admin/engines/settings.rst +++ b/docs/admin/engines/settings.rst @@ -72,12 +72,16 @@ Global Settings 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`` : ``$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. +``privacypolicy_url``: + Link to privacy policy. + ``contact_url``: Contact ``mailto:`` address or WEB form. diff --git a/docs/conf.py b/docs/conf.py index 171e864e..75046491 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,6 +18,7 @@ SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng' ISSUE_URL = get_setting('brand.issue_url') DOCS_URL = get_setting('brand.docs_url') PUBLIC_INSTANCES = get_setting('brand.public_instances') +PRIVACYPOLICY_URL = get_setting('general.privacypolicy_url') CONTACT_URL = get_setting('general.contact_url') WIKI_URL = get_setting('brand.wiki_url') @@ -172,6 +173,8 @@ if PUBLIC_INSTANCES: html_context["project_links"].append(ProjectLink("Public instances", PUBLIC_INSTANCES)) if ISSUE_URL: html_context["project_links"].append(ProjectLink("Issue Tracker", ISSUE_URL)) +if PRIVACYPOLICY_URL: + html_context["project_links"].append(ProjectLink("Privacy Policy", PRIVACYPOLICY_URL)) if CONTACT_URL: html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL)) diff --git a/searx/settings.yml b/searx/settings.yml index 4ade99a0..bf0ae9dc 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1,6 +1,7 @@ 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 diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py index 938b9714..35089fbd 100644 --- a/searx/settings_defaults.py +++ b/searx/settings_defaults.py @@ -140,6 +140,7 @@ SCHEMA = { 'general': { 'debug': SettingsValue(bool, False, 'SEARXNG_DEBUG'), 'instance_name': SettingsValue(str, 'SearXNG'), + 'privacypolicy_url': SettingsValue((None, False, str), None), 'contact_url': SettingsValue((None, False, str), None), 'enable_metrics': SettingsValue(bool, True), }, diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index d8eaaa02..7e5f535d 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -55,8 +55,13 @@ {{ _('Source code') }} | {{ _('Issue tracker') }} | {{ _('Engine stats') }} | - {{ _('Public instances') }}{% if get_setting('general.contact_url') %} | - {{ _('Contact instance maintainer') }}{% endif %} + {{ _('Public instances') }} + {% if get_setting('general.privacypolicy_url') %} + | {{ _('Privacy policy') }} + {% endif %} + {% if get_setting('general.contact_url') %} + | {{ _('Contact instance maintainer') }} + {% endif %}

diff --git a/searx/webapp.py b/searx/webapp.py index 2ec2f7ed..d4fb1c7d 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1355,6 +1355,7 @@ def config(): 'default_theme': settings['ui']['default_theme'], 'version': VERSION_STRING, 'brand': { + 'PRIVACYPOLICY_URL': get_setting('general.privacypolicy_url'), 'CONTACT_URL': get_setting('general.contact_url'), 'GIT_URL': GIT_URL, 'GIT_BRANCH': GIT_BRANCH,