Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 465bbd44 authored by Ben Collerson's avatar Ben Collerson Committed by GitHub
Browse files

[enh] archive.today option for results page (#3308)

Adds an option to the oscar theme that puts an archive.today link next to the web.archive.org cache link. In preferences change 'Show archive.today links' to 'On'
parent 78a87caa
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -354,6 +354,16 @@ class Preferences:
                    'True': True
                }
            ),
            'archive_today': MapSetting(
                settings['ui'].get('archive_today', True),
                is_locked('archive_today'),
                map={
                    '0': False,
                    '1': True,
                    'False': False,
                    'True': True
                }
            ),
            'image_proxy': MapSetting(
                settings['server'].get('image_proxy', False),
                is_locked('image_proxy'),
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ server:

ui:
    autofocus : True # Autofocus search input
    archive_today : False # show archive.today links
    static_path : "" # Custom static path - leave it blank if you didn't change
    templates_path : "" # Custom templates path - leave it blank if you didn't change
    default_theme : oscar # ui theme
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@
            <small>{{ result_link(result.cached_url, icon('link') + _('cached'), "text-info", id) }}</small>
            {%- elif not result.is_onion -%}
            <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
	        {% if archive_today %}
	    <small>{{ result_link("https://archive.today/" + result.url, icon('link') + _('archive'), "text-info", id) }}</small>
                {% endif %}
            {%- endif -%}
        {%- endif -%}
        {%- if proxify -%}
@@ -72,6 +75,9 @@
        <small>{{ result_link(result.cached_url, icon('link') + _('cached'), "text-info", id) }}</small>
        {%- elif not result.is_onion -%}
        <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
	    {% if archive_today %}
	<small>{{ result_link("https://archive.today/" + result.url, icon('link') + _('archive'), "text-info", id) }}</small>
	    {% endif %}
        {%- endif -%}
    {%- endif -%}
    {%- if proxify -%}
+11 −0
Original line number Diff line number Diff line
@@ -161,6 +161,17 @@
                    {{ preferences_item_footer(info, label, rtl) }}
                    {% endif %}

                    {% if 'archive_today' not in locked_preferences %}
                    {% set label = _('Show archive.today links') %}
                    {% set info = _('Alternative link cache service') %}
                    {{ preferences_item_header(info, label, rtl, 'archive_today') }}
                        <select class="form-control {{ custom_select_class(rtl) }}" name="archive_today" id="archive_today">
                            <option value="1" {% if archive_today %}selected="selected"{% endif %}>{{ _('On') }}</option>
                            <option value="0" {% if not archive_today %}selected="selected"{% endif %}>{{ _('Off')}}</option>
                        </select>
                    {{ preferences_item_footer(info, label, rtl) }}
                    {% endif %}

                    {% set label = _('Show advanced settings') %}
                    {% set info = _('Show advanced settings panel in the home page by default') %}
                    {{ preferences_item_header(info, label, rtl, 'advanced_search') }}
+2 −0
Original line number Diff line number Diff line
@@ -389,6 +389,8 @@ def render(template_name, override_theme=None, **kwargs):

    kwargs['autofocus'] = request.preferences.get_value('autofocus')

    kwargs['archive_today'] = request.preferences.get_value('archive_today')

    kwargs['safesearch'] = str(request.preferences.get_value('safesearch'))

    kwargs['language_codes'] = languages