feat: Add attachment management with upload, deletion, serving, and media metadata stripping.

This commit is contained in:
2026-03-03 17:24:45 +00:00
parent 57f2610164
commit 82f7e006cf
8 changed files with 1085 additions and 3 deletions

View File

@@ -0,0 +1,47 @@
{% extends "base.html" %}
{% block title %}Manage Attachments{% endblock %}
{% block content %}
<h2>Manage Attachments</h2>
<a href="/__dungeon">&lt; Back to Dashboard</a><br><br>
<b>Upload New Attachment</b><br>
<form method="POST" action="/__dungeon/attachments/upload" enctype="multipart/form-data">
File: <input type="file" name="file" required><br><br>
<input type="submit" value="Upload Attachment">
</form>
<br>
<b>Existing Attachments</b><br>
{% if attachments.is_empty() %}
<p>No attachments found.</p>
{% else %}
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<th>ID</th>
<th>Filename</th>
<th>Type</th>
<th>Size</th>
<th>Created At</th>
<th>Actions</th>
</tr>
{% for att in attachments %}
<tr>
<td><code>{{ att.id }}</code></td>
<td><a href="/__attachments/{{ att.id }}" target="_blank">{{ att.filename }}</a></td>
<td>{{ att.content_type }}</td>
<td>{{ att.size }} bytes</td>
<td>{{ att.formatted_created_at() }}</td>
<td>
<form method="POST" action="/__dungeon/attachments/delete/{{ att.id }}" style="display:inline;"
onsubmit="return confirm('Are you sure you want to delete this attachment?');">
<input type="submit" value="Delete">
</form>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}

View File

@@ -12,6 +12,7 @@
<b>Features</b><br>
<ul>
<li><a href="/__dungeon/posts">Manage Blog Posts</a></li>
<li><a href="/__dungeon/attachments">Manage Attachments</a></li>
</ul>
<br>