feat: initial postcard manager - FastAPI + Jinja2 + SQLite

This commit is contained in:
2026-07-05 16:06:03 +08:00
commit 0eca60300f
24 changed files with 1304 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block title %}API Keys - Postcard Manager{% endblock %}
{% block content %}
<div class="section-header">
<h1>API Keys</h1>
<form method="post" action="/api-keys">
<button type="submit" class="btn btn-primary">+ 创建新 Key</button>
</form>
</div>
{% if keys %}
<table>
<thead><tr><th>Key</th><th>创建时间</th><th>操作</th></tr></thead>
<tbody>
{% for k in keys %}
<tr>
<td><code>{{ k.key }}</code></td>
<td>{{ k.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
<td>
<form method="post" action="/api-keys/{{ k.id }}/delete" class="inline">
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确定删除该 Key')">删除</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="empty">还没有 API Key点击上方按钮创建一个。</p>
{% endif %}
<section class="section" style="margin-top:2rem">
<h2>使用说明</h2>
<pre>curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:8000/api/profiles</pre>
</section>
{% endblock %}