From 8ebf3e2f93188013b494dcfea29e939f1fd7f348 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 9 May 2022 19:31:41 -0700 Subject: [PATCH] add config option PREVIEW_ORIGINALS to hide original iframes in snapshot detail pages --- archivebox/config.py | 1 + archivebox/index/html.py | 2 ++ archivebox/templates/core/snapshot.html | 2 ++ 3 files changed, 5 insertions(+) diff --git a/archivebox/config.py b/archivebox/config.py index 21e48ff2..3da4b304 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -94,6 +94,7 @@ CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = { 'SNAPSHOTS_PER_PAGE': {'type': int, 'default': 40}, 'CUSTOM_TEMPLATES_DIR': {'type': str, 'default': None}, 'TIME_ZONE': {'type': str, 'default': 'UTC'}, + 'PREVIEW_ORIGINALS': {'type': bool, 'default': True}, }, 'ARCHIVE_METHOD_TOGGLES': { diff --git a/archivebox/index/html.py b/archivebox/index/html.py index d45f66ea..66e26fab 100644 --- a/archivebox/index/html.py +++ b/archivebox/index/html.py @@ -24,6 +24,7 @@ from ..config import ( FOOTER_INFO, HTML_INDEX_FILENAME, SAVE_ARCHIVE_DOT_ORG, + PREVIEW_ORIGINALS, ) MAIN_INDEX_TEMPLATE = 'static_index.html' @@ -105,6 +106,7 @@ def link_details_template(link: Link) -> str: 'status_color': 'success' if link.is_archived else 'danger', 'oldest_archive_date': ts_to_date_str(link.oldest_archive_date), 'SAVE_ARCHIVE_DOT_ORG': SAVE_ARCHIVE_DOT_ORG, + 'PREVIEW_ORIGINALS': PREVIEW_ORIGINALS, }) @enforce_types diff --git a/archivebox/templates/core/snapshot.html b/archivebox/templates/core/snapshot.html index ccb74227..9b8b1e53 100644 --- a/archivebox/templates/core/snapshot.html +++ b/archivebox/templates/core/snapshot.html @@ -414,6 +414,7 @@ {% endif %} + {% if PREVIEW_ORIGINALS %}
@@ -427,6 +428,7 @@
+ {{% endif %}}