Merge pull request #1329 from samsaptidev/feature/privacypolicy_url

Add privacypolicy_url option
This commit is contained in:
Alexandre Flament 2022-06-18 07:26:40 +02:00 committed by GitHub
commit a7b0b2ecbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 2 deletions

View File

@ -163,3 +163,4 @@ features or generally made searx better:
- @xenrox - @xenrox
- @OliveiraHermogenes - @OliveiraHermogenes
- Paul Alcock @Guilvareux - Paul Alcock @Guilvareux
- Sam A. `<https://samsapti.dev>`_

View File

@ -72,12 +72,16 @@ Global Settings
general: general:
debug: false # Debug mode, only for development debug: false # Debug mode, only for development
instance_name: "SearXNG" # displayed name instance_name: "SearXNG" # displayed name
privacypolicy_url: false # https://example.com/privacy
contact_url: false # mailto:contact@example.com contact_url: false # mailto:contact@example.com
``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.
``privacypolicy_url``:
Link to privacy policy.
``contact_url``: ``contact_url``:
Contact ``mailto:`` address or WEB form. Contact ``mailto:`` address or WEB form.

View File

@ -18,6 +18,7 @@ SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng'
ISSUE_URL = get_setting('brand.issue_url') ISSUE_URL = get_setting('brand.issue_url')
DOCS_URL = get_setting('brand.docs_url') DOCS_URL = get_setting('brand.docs_url')
PUBLIC_INSTANCES = get_setting('brand.public_instances') PUBLIC_INSTANCES = get_setting('brand.public_instances')
PRIVACYPOLICY_URL = get_setting('general.privacypolicy_url')
CONTACT_URL = get_setting('general.contact_url') CONTACT_URL = get_setting('general.contact_url')
WIKI_URL = get_setting('brand.wiki_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)) html_context["project_links"].append(ProjectLink("Public instances", PUBLIC_INSTANCES))
if ISSUE_URL: if ISSUE_URL:
html_context["project_links"].append(ProjectLink("Issue Tracker", 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: if CONTACT_URL:
html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL)) html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL))

View File

@ -1,6 +1,7 @@
general: general:
debug: false # Debug mode, only for development debug: false # Debug mode, only for development
instance_name: "SearXNG" # displayed name instance_name: "SearXNG" # displayed name
privacypolicy_url: false # https://example.com/privacy
contact_url: false # mailto:contact@example.com contact_url: false # mailto:contact@example.com
enable_metrics: true # record stats enable_metrics: true # record stats

View File

@ -140,6 +140,7 @@ SCHEMA = {
'general': { 'general': {
'debug': SettingsValue(bool, False, 'SEARXNG_DEBUG'), 'debug': SettingsValue(bool, False, 'SEARXNG_DEBUG'),
'instance_name': SettingsValue(str, 'SearXNG'), 'instance_name': SettingsValue(str, 'SearXNG'),
'privacypolicy_url': SettingsValue((None, False, str), None),
'contact_url': SettingsValue((None, False, str), None), 'contact_url': SettingsValue((None, False, str), None),
'enable_metrics': SettingsValue(bool, True), 'enable_metrics': SettingsValue(bool, True),
}, },

View File

@ -55,8 +55,13 @@
<a href="{{ searx_git_url }}">{{ _('Source code') }}</a> | <a href="{{ searx_git_url }}">{{ _('Source code') }}</a> |
<a href="{{ get_setting('brand.issue_url') }}">{{ _('Issue tracker') }}</a> | <a href="{{ get_setting('brand.issue_url') }}">{{ _('Issue tracker') }}</a> |
<a href="{{ url_for('stats') }}">{{ _('Engine stats') }}</a> | <a href="{{ url_for('stats') }}">{{ _('Engine stats') }}</a> |
<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>{% if get_setting('general.contact_url') %} | <a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>
<a href="{{ get_setting('general.contact_url') }}">{{ _('Contact instance maintainer') }}</a>{% endif %} {% if get_setting('general.privacypolicy_url') %}
| <a href="{{ get_setting('general.privacypolicy_url') }}">{{ _('Privacy policy') }}</a>
{% endif %}
{% if get_setting('general.contact_url') %}
| <a href="{{ get_setting('general.contact_url') }}">{{ _('Contact instance maintainer') }}</a>
{% endif %}
</p> </p>
</footer> </footer>
<!--[if gte IE 9]>--> <!--[if gte IE 9]>-->

View File

@ -1355,6 +1355,7 @@ def config():
'default_theme': settings['ui']['default_theme'], 'default_theme': settings['ui']['default_theme'],
'version': VERSION_STRING, 'version': VERSION_STRING,
'brand': { 'brand': {
'PRIVACYPOLICY_URL': get_setting('general.privacypolicy_url'),
'CONTACT_URL': get_setting('general.contact_url'), 'CONTACT_URL': get_setting('general.contact_url'),
'GIT_URL': GIT_URL, 'GIT_URL': GIT_URL,
'GIT_BRANCH': GIT_BRANCH, 'GIT_BRANCH': GIT_BRANCH,