diff --git a/src/auto_archiver/formatters/html_formatter.py b/src/auto_archiver/formatters/html_formatter.py index 3449a0a..da79ab0 100644 --- a/src/auto_archiver/formatters/html_formatter.py +++ b/src/auto_archiver/formatters/html_formatter.py @@ -4,7 +4,8 @@ import mimetypes, os, pathlib from jinja2 import Environment, FileSystemLoader from urllib.parse import quote from loguru import logger -import minify_html +import minify_html, json +import base64 from ..version import __version__ from ..core import Metadata, Media, ArchivingContext @@ -92,3 +93,8 @@ class JinjaHelpers: @staticmethod def quote(s: str) -> str: return quote(s) + + @staticmethod + def json_dump_b64(d: dict) -> str: + j = json.dumps(d, indent=4, default=str) + return base64.b64encode(j.encode()).decode() diff --git a/src/auto_archiver/formatters/templates/html_template.html b/src/auto_archiver/formatters/templates/html_template.html index 93dc43a..175a579 100644 --- a/src/auto_archiver/formatters/templates/html_template.html +++ b/src/auto_archiver/formatters/templates/html_template.html @@ -180,13 +180,16 @@ {{ key }} + {% if metadata[key] is mapping %} +
Copy as JSON
+ {% endif %} {{ macros.copy_urlize(metadata[key]) }} {% endfor %} -

Made with Made with bellingcat/auto-archiver v{{ version }}

@@ -194,7 +197,7 @@ // partial decode of SSL certificates function decodeCertificate(sslCert) { var cert = forge.pki.certificateFromPem(sslCert); - return `PREVIEW: