Fix cache detail template field names

This commit is contained in:
gilesb
2026-01-11 16:53:48 +00:00
parent 921d81421a
commit f6a7e0852c

View File

@@ -1,40 +1,40 @@
{% extends "base.html" %}
{% block title %}{{ cache.hash[:16] }} - Cache - Art-DAG L1{% endblock %}
{% block title %}{{ cache.content_hash[:16] }} - Cache - Art-DAG L1{% endblock %}
{% block content %}
<div class="max-w-4xl mx-auto">
<!-- Header -->
<div class="flex items-center space-x-4 mb-6">
<a href="/media" class="text-gray-400 hover:text-white">&larr; Media</a>
<h1 class="text-xl font-bold font-mono">{{ cache.hash[:24] }}...</h1>
<h1 class="text-xl font-bold font-mono">{{ cache.content_hash[:24] }}...</h1>
</div>
<!-- Preview -->
<div class="bg-gray-800 rounded-lg border border-gray-700 mb-6 overflow-hidden">
{% if cache.media_type and cache.media_type.startswith('image/') %}
<img src="/cache/{{ cache.hash }}/raw" alt=""
{% if cache.mime_type and cache.mime_type.startswith('image/') %}
<img src="/cache/{{ cache.content_hash }}/raw" alt=""
class="w-full max-h-96 object-contain bg-gray-900">
{% elif cache.media_type and cache.media_type.startswith('video/') %}
<video src="/cache/{{ cache.hash }}/raw" controls
{% elif cache.mime_type and cache.mime_type.startswith('video/') %}
<video src="/cache/{{ cache.content_hash }}/raw" controls
class="w-full max-h-96 bg-gray-900">
</video>
{% elif cache.media_type and cache.media_type.startswith('audio/') %}
{% elif cache.mime_type and cache.mime_type.startswith('audio/') %}
<div class="p-8 bg-gray-900">
<audio src="/cache/{{ cache.hash }}/raw" controls class="w-full"></audio>
<audio src="/cache/{{ cache.content_hash }}/raw" controls class="w-full"></audio>
</div>
{% elif cache.media_type == 'application/json' %}
{% elif cache.mime_type == 'application/json' %}
<div class="p-4 bg-gray-900 max-h-96 overflow-auto">
<pre class="text-sm text-gray-300">{{ cache.content_preview }}</pre>
</div>
{% else %}
<div class="p-8 bg-gray-900 text-center text-gray-500">
<div class="text-4xl mb-2">{{ cache.media_type or 'Unknown type' }}</div>
<div>{{ cache.size_bytes | filesizeformat if cache.size_bytes else 'Unknown size' }}</div>
<div class="text-4xl mb-2">{{ cache.mime_type or 'Unknown type' }}</div>
<div>{{ cache.size | filesizeformat if cache.size else 'Unknown size' }}</div>
</div>
{% endif %}
</div>
@@ -43,15 +43,15 @@
<div class="grid grid-cols-2 gap-4 mb-6">
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Hash</div>
<div class="font-mono text-sm text-white break-all">{{ cache.hash }}</div>
<div class="font-mono text-sm text-white break-all">{{ cache.content_hash }}</div>
</div>
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Content Type</div>
<div class="text-white">{{ cache.media_type or 'Unknown' }}</div>
<div class="text-white">{{ cache.mime_type or 'Unknown' }}</div>
</div>
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Size</div>
<div class="text-white">{{ cache.size_bytes | filesizeformat if cache.size_bytes else 'Unknown' }}</div>
<div class="text-white">{{ cache.size | filesizeformat if cache.size else 'Unknown' }}</div>
</div>
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Created</div>
@@ -92,13 +92,13 @@
<!-- Actions -->
<div class="flex items-center space-x-4 mt-8">
<a href="/cache/{{ cache.hash }}/raw"
<a href="/cache/{{ cache.content_hash }}/raw"
download
class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded font-medium">
Download
</a>
{% if not cache.ipfs_cid %}
<button hx-post="/cache/{{ cache.hash }}/publish"
<button hx-post="/cache/{{ cache.content_hash }}/publish"
hx-target="#publish-result"
class="bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded font-medium">
Publish to IPFS