summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-09-04 09:36:01 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2022-09-04 09:42:20 +0200
commitad8ffd222cf9edbd9ce474473dfe231c1f6afda7 (patch)
tree5d1e7ca904596876a234839963a2f4d3944918be
parent9ab843813229476744b4206a26dedb26b36c1782 (diff)
downloadsearxng-ad8ffd222cf9edbd9ce474473dfe231c1f6afda7.tar.gz
searxng-ad8ffd222cf9edbd9ce474473dfe231c1f6afda7.zip
[mod] option 'ui: cache_url:' to configure internet cache or archive
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--docs/admin/engines/settings.rst10
-rw-r--r--searx/settings.yml2
-rw-r--r--searx/settings_defaults.py1
-rw-r--r--searx/templates/simple/macros.html2
-rwxr-xr-xsearx/webapp.py1
5 files changed, 15 insertions, 1 deletions
diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst
index f85c6a75f..b1853a11b 100644
--- a/docs/admin/engines/settings.rst
+++ b/docs/admin/engines/settings.rst
@@ -240,6 +240,7 @@ Global Settings
query_in_title: false
infinite_scroll: false
center_alignment: false
+ cache_url: https://web.archive.org/web/
default_theme: simple
theme_args:
simple_style: auto
@@ -267,6 +268,15 @@ Global Settings
side of the screen. This setting only affects the *desktop layout*
(:origin:`min-width: @tablet <searx/static/themes/simple/src/less/definitions.less>`)
+.. cache_url:
+
+``cache_url`` : ``https://web.archive.org/web/``
+ URL prefix of the internet archive or cache, don't forgett trailing slash (if
+ needed). The default is https://web.archive.org/web/ alternatives are:
+
+ - https://webcache.googleusercontent.com/search?q=cache:
+ - https://archive.today/
+
``default_theme`` :
Name of the theme you want to use by default on your SearXNG instance.
diff --git a/searx/settings.yml b/searx/settings.yml
index 5587ed51a..96ebd9715 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -95,6 +95,8 @@ ui:
default_theme: simple
# center the results ?
center_alignment: false
+ # URL prefix of the internet archive, don't forgett trailing slash (if needed).
+ # cache_url: "https://webcache.googleusercontent.com/search?q=cache:"
# Default interface locale - leave blank to detect from browser information or
# use codes from the 'locales' config section
default_locale: ""
diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py
index 4e06fb023..330878c1f 100644
--- a/searx/settings_defaults.py
+++ b/searx/settings_defaults.py
@@ -190,6 +190,7 @@ SCHEMA = {
'advanced_search': SettingsValue(bool, False),
'query_in_title': SettingsValue(bool, False),
'infinite_scroll': SettingsValue(bool, False),
+ 'cache_url': SettingsValue(str, 'https://web.archive.org/web/'),
},
'preferences': {
'lock': SettingsValue(list, []),
diff --git a/searx/templates/simple/macros.html b/searx/templates/simple/macros.html
index e06157867..d9af3fbbb 100644
--- a/searx/templates/simple/macros.html
+++ b/searx/templates/simple/macros.html
@@ -42,7 +42,7 @@
{%- macro result_sub_footer(result, proxify) -%}
<div class="engines">
{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}
- {{ result_link("https://web.archive.org/web/" + result.url, icon_small('ellipsis-vertical-outline') + _('cached'), "cache_link") }}&lrm; {% if proxify and proxify_results %} {{ result_link(proxify(result.url), icon('link') + _('proxied'), "proxyfied_link") }} {% endif %}
+ {{ result_link(cache_url + result.url, icon_small('ellipsis-vertical-outline') + _('cached'), "cache_link") }}&lrm; {% if proxify and proxify_results %} {{ result_link(proxify(result.url), icon('link') + _('proxied'), "proxyfied_link") }} {% endif %}
</div>{{- '' -}}
<div class="break"></div>{{- '' -}}
{%- endmacro -%}
diff --git a/searx/webapp.py b/searx/webapp.py
index 8c2046b5c..369b2d2db 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -464,6 +464,7 @@ def render(template_name: str, **kwargs):
kwargs['image_proxify'] = image_proxify
kwargs['proxify'] = morty_proxify if settings['result_proxy']['url'] is not None else None
kwargs['proxify_results'] = settings['result_proxy']['proxify_results']
+ kwargs['cache_url'] = settings['ui']['cache_url']
kwargs['get_result_template'] = get_result_template
kwargs['opensearch_url'] = (
url_for('opensearch')