添加api调用接口

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-08 22:24:33 +08:00
parent a26f7214f9
commit e542c482d7
19 changed files with 410 additions and 25 deletions

View File

@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
<h2>API Keys Management</h2>
<div class="card mb-4">
<div class="card-header">Create New API Key</div>
<div class="card-body">
<form action="{{ url_for('admin.add_api_key') }}" method="POST" class="form-inline">
<input type="text" name="name" class="form-control mb-2 mr-sm-2" placeholder="Key Name" required>
<button type="submit" class="btn btn-primary mb-2">Generate Key</button>
</form>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>API Key</th>
<th>Created At</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for key in keys %}
<tr>
<td>{{ key.id }}</td>
<td>{{ key.name }}</td>
<td><code>{{ key.key }}</code></td>
<td>{{ key.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</td>
<td>
<form action="{{ url_for('admin.delete_api_key', key_id=key.id) }}" method="POST" style="display:inline;">
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this API Key?');">Delete</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="5" class="text-center">No API keys found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}