archivebox.core.templatetags.core_tagsο
Module Contentsο
Functionsο
Emphasize the hostname while preserving the exact selectable URL. |
|
Optional plugin UI must never prevent the host page from rendering. |
|
Hide the informational mismatch banner on the conventional public web alias. |
|
Monkey patched result |
|
Cached wrapper around the Machine-admin stats util. |
|
Render the top-of-page warning banner for one of the conditions below, in priority order (highest first): |
|
Keep the trusted snapshot detail page on web.*, not the replay host. |
|
Build a saved-file URL from one ArchiveResult declaration. |
|
Render the icon for a plugin. |
|
Render the card template for an archive result. |
|
Render one plugin card template for the trusted snapshot-origin frame. |
|
Render the full template for an archive result. |
|
Get the base name of a plugin (strips numeric prefix). |
|
Return an API token string for the logged-in user, creating one if needed. |
Dataο
APIο
- archivebox.core.templatetags.core_tags.CARD_OVERFLOW_STYLE[source]ο
β<style>html,body{height:100%!important;min-height:0!important}html,body,body *{overflow:clip!importaβ¦β
- archivebox.core.templatetags.core_tags.snapshot_url_text(url)[source]ο
Emphasize the hostname while preserving the exact selectable URL.
- archivebox.core.templatetags.core_tags.plugin_ui(context, plugin: str, slot: str)[source]ο
Optional plugin UI must never prevent the host page from rendering.
- archivebox.core.templatetags.core_tags._TEXT_PREVIEW_EXTS[source]ο
(β.jsonβ, β.jsonlβ, β.txtβ, β.csvβ, β.tsvβ, β.xmlβ, β.ymlβ, β.yamlβ, β.mdβ, β.logβ)
- archivebox.core.templatetags.core_tags._IMAGE_PREVIEW_EXTS[source]ο
(β.pngβ, β.jpgβ, β.jpegβ, β.gifβ, β.webpβ, β.bmpβ, β.icoβ, β.avifβ)
- archivebox.core.templatetags.core_tags._is_web_subdomain_alias(browser_url: str, configured_base_url: str) → bool[source]ο
Hide the informational mismatch banner on the conventional public web alias.
This is deliberately presentation-only: request routing and the restriction on state-changing requests continue to use the configured BASE_URL.
- archivebox.core.templatetags.core_tags._normalize_output_files(output_files: Any) → dict[str, dict[str, Any]][source]ο
- archivebox.core.templatetags.core_tags._list_media_files(result, *, include_filesystem_fallback=True) → list[dict][source]ο
- archivebox.core.templatetags.core_tags._resolve_snapshot_output_file(snapshot_dir: str | pathlib.Path | None, raw_output_path: str | None) → pathlib.Path | None[source]ο
- archivebox.core.templatetags.core_tags._is_text_preview_path(raw_output_path: str | None) → bool[source]ο
- archivebox.core.templatetags.core_tags._is_image_preview_path(raw_output_path: str | None) → bool[source]ο
- archivebox.core.templatetags.core_tags._is_root_snapshot_output_path(raw_output_path: str | None) → bool[source]ο
- archivebox.core.templatetags.core_tags._static_snapshot_base_url(context, snapshot) → str[source]ο
- archivebox.core.templatetags.core_tags._snapshot_base_url_for_context(context, snapshot) → str[source]ο
- archivebox.core.templatetags.core_tags._snapshot_url_for_context(context, snapshot, path: str = '') → str[source]ο
- archivebox.core.templatetags.core_tags._build_snapshot_preview_url(snapshot_id: str, path: str = '', request=None, config=None, plugin: str = '', base_url: str | None = None) → str[source]ο
- archivebox.core.templatetags.core_tags._render_text_preview(plugin: str, icon_html: str, snippet: str) → str[source]ο
- archivebox.core.templatetags.core_tags._render_fallback_card(plugin: str, icon_html: str, fallback_label: str) → str[source]ο
- archivebox.core.templatetags.core_tags._render_text_file_preview(snapshot_dir: str | pathlib.Path | None, raw_output_path: str | None, plugin: str, icon_html: str) → str | None[source]ο
- archivebox.core.templatetags.core_tags.file_size(num_bytes: float, decimal_places: int = 1) → str[source]ο
- archivebox.core.templatetags.core_tags._machine_health_stats() → dict[source]ο
Cached wrapper around the Machine-admin stats util.
The Machine list/change pages already render disk / mem / load via
archivebox.machine.detect.get_host_stats()β we reuse the same call so the banner thresholds line up 1:1 with whatβs shown on /admin/machine/. Cached for 30s because the inclusion tag fires on every page render andget_host_statsshells into several psutil probes.
- archivebox.core.templatetags.core_tags.system_warnings_banner(context)[source]ο
Render the top-of-page warning banner for one of the conditions below, in priority order (highest first):
mode="unconfigured"βBASE_URLis empty and the operator has not selected safe single-domain routing. That mode intentionally uses each deviceβs connection address, including LAN and Tailscale IPs.mode="base_url_mismatch"β the browser reached ArchiveBox through an origin that differs from the configured canonicalBASE_URL.mode="unsafe"βSERVER_SECURITY_MODEexplicitly enables a lower-security replay mode.mode="low_disk"βDATA_DIRhas <1 GiB free; new archive jobs will start failing on ENOSPC.mode="high_memory"β virtual memory utilization at/above 95%; the host is one OOM-kill from a crash.mode="high_load"β 15-minute load average exceeds 3 Γ CPU count (the kernelβs own sustained-load EMA, so no rolling buffer of ours is needed).
Config/security warnings come first because they affect correctness + security and need explicit operator action; host-health warnings come after and reuse
machine.detect.get_host_stats(the same function that populates the Machine admin page), cached for 30s.
- archivebox.core.templatetags.core_tags.snapshot_detail_url(context, snapshot) → str[source]ο
Keep the trusted snapshot detail page on web.*, not the replay host.
- archivebox.core.templatetags.core_tags.snapshot_url(context, snapshot, path: str = '') → str[source]ο
- archivebox.core.templatetags.core_tags.snapshot_files_url(context, snapshot, path: str = '') → str[source]ο
- archivebox.core.templatetags.core_tags.snapshot_zip_url(context, snapshot, path: str = '') → str[source]ο
- archivebox.core.templatetags.core_tags.snapshot_role_output_url(context, snapshot, role: str, fallback_to_default: bool = False) → str[source]ο
- archivebox.core.templatetags.core_tags.snapshot_result_file_url(context, snapshot, result, path: str) → str[source]ο
Build a saved-file URL from one ArchiveResult declaration.
- archivebox.core.templatetags.core_tags.snapshot_thumbnail(context, snapshot, admin=False, width='100px', height='100px')[source]ο
- archivebox.core.templatetags.core_tags.snapshot_preview_url(context, snapshot, path: str = '', result=None) → str[source]ο
- archivebox.core.templatetags.core_tags.plugin_icon(plugin: str) → str[source]ο
Render the icon for a plugin.
Usage: {% plugin_icon βscreenshotβ %}
- archivebox.core.templatetags.core_tags.plugin_card(context, result) → str[source]ο
Render the card template for an archive result.
Usage: {% plugin_card result %}
Context variables passed to template: - result: ArchiveResult object - snapshot: Parent Snapshot object - output_path: Path to output relative to snapshot dir (from embed_path()) - plugin: Plugin base name
- archivebox.core.templatetags.core_tags.render_plugin_card_document(context, result) → str[source]ο
Render one plugin card template for the trusted snapshot-origin frame.
- archivebox.core.templatetags.core_tags.output_card(snapshot, output_path: str, plugin: str) → str[source]ο
- archivebox.core.templatetags.core_tags.plugin_full(context, result) → str[source]ο
Render the full template for an archive result.
Usage: {% plugin_full result %}