Merge pull request #1714 from return42/mod-archive

[mod] option 'server: archive_url:' to configure internet archive
This commit is contained in:
Markus Heiser 2022-09-04 09:49:06 +02:00 committed by GitHub
commit 0d1af21f9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 1 deletions

View File

@ -240,6 +240,7 @@ Global Settings
query_in_title: false query_in_title: false
infinite_scroll: false infinite_scroll: false
center_alignment: false center_alignment: false
cache_url: https://web.archive.org/web/
default_theme: simple default_theme: simple
theme_args: theme_args:
simple_style: auto simple_style: auto
@ -267,6 +268,15 @@ Global Settings
side of the screen. This setting only affects the *desktop layout* side of the screen. This setting only affects the *desktop layout*
(:origin:`min-width: @tablet <searx/static/themes/simple/src/less/definitions.less>`) (: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`` : ``default_theme`` :
Name of the theme you want to use by default on your SearXNG instance. Name of the theme you want to use by default on your SearXNG instance.

View File

@ -95,6 +95,8 @@ ui:
default_theme: simple default_theme: simple
# center the results ? # center the results ?
center_alignment: false 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 # Default interface locale - leave blank to detect from browser information or
# use codes from the 'locales' config section # use codes from the 'locales' config section
default_locale: "" default_locale: ""

View File

@ -190,6 +190,7 @@ SCHEMA = {
'advanced_search': SettingsValue(bool, False), 'advanced_search': SettingsValue(bool, False),
'query_in_title': SettingsValue(bool, False), 'query_in_title': SettingsValue(bool, False),
'infinite_scroll': SettingsValue(bool, False), 'infinite_scroll': SettingsValue(bool, False),
'cache_url': SettingsValue(str, 'https://web.archive.org/web/'),
}, },
'preferences': { 'preferences': {
'lock': SettingsValue(list, []), 'lock': SettingsValue(list, []),

View File

@ -42,7 +42,7 @@
{%- macro result_sub_footer(result, proxify) -%} {%- macro result_sub_footer(result, proxify) -%}
<div class="engines"> <div class="engines">
{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %} {% 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>{{- '' -}}
<div class="break"></div>{{- '' -}} <div class="break"></div>{{- '' -}}
{%- endmacro -%} {%- endmacro -%}

View File

@ -464,6 +464,7 @@ def render(template_name: str, **kwargs):
kwargs['image_proxify'] = image_proxify kwargs['image_proxify'] = image_proxify
kwargs['proxify'] = morty_proxify if settings['result_proxy']['url'] is not None else None kwargs['proxify'] = morty_proxify if settings['result_proxy']['url'] is not None else None
kwargs['proxify_results'] = settings['result_proxy']['proxify_results'] kwargs['proxify_results'] = settings['result_proxy']['proxify_results']
kwargs['cache_url'] = settings['ui']['cache_url']
kwargs['get_result_template'] = get_result_template kwargs['get_result_template'] = get_result_template
kwargs['opensearch_url'] = ( kwargs['opensearch_url'] = (
url_for('opensearch') url_for('opensearch')