feat: API-Keys-Verwaltung in DB statt appsettings

- Neue Tabelle api_keys (Provider, Name, ApiKey, IsActive)
- Admin-CRUD: GET/POST/PUT/DELETE /api/admin/api-keys
- Aktivieren/Deaktivieren pro Provider (nur einer aktiv)
- Live-Token-Update im AnthropicService ohne Neustart
- Migration: AnthropicToken aus appsettings.Production.json → DB
- AnthropicToken aus ServerSettings-Definitionen + appsettings entfernt
- Frontend: API-Keys-Seite mit Erstellen/Bearbeiten/Löschen/Toggle
- Dashboard: API-Keys-Link für Admins
This commit is contained in:
Meleki committed 2026-03-12 12:07:22 +01:00
1 parent 1228dc9d58
commit fa8deb15b6
11 files changed
+649 -4

No files matched your search

+35
View File
@@ -57,6 +57,7 @@
<div class="dashboard-links">
<a id="dashboardSettingsLink" class="dashboard-link">Einstellungen</a>
<a id="dashboardAdminLink" class="dashboard-link" hidden>Benutzerverwaltung</a>
<a id="dashboardApiKeysLink" class="dashboard-link" hidden>API-Keys</a>
<a id="dashboardServerSettingsLink" class="dashboard-link" hidden>Servereinstellungen</a>
<a id="dashboardProfileLink" class="dashboard-link">Mein Profil</a>
</div>
@@ -539,6 +540,39 @@
</div>
</template>
<template id="tpl-api-keys">
<div class="page form-page">
<header>
<button class="back-btn icon-btn" data-page="dashboard"><i class="fa fa-arrow-left"></i></button>
<h1>API-Keys</h1>
</header>
<div class="page-content">
<div class="form">
<div class="section-header">
<h2>API-Key</h2>
<button id="apiKeysNewBtn" class="section-add-btn"><i class="fa fa-plus"></i> Neuer Key</button>
</div>
<div id="apiKeysList" class="admin-user-list"></div>
</div>
<div id="apiKeysForm" class="form" hidden>
<h2 id="apiKeysFormTitle">Neuer API-Key</h2>
<label>Provider</label>
<select id="apiKeysProvider">
<option value="anthropic">Anthropic</option>
</select>
<label>Name</label>
<input type="text" id="apiKeysName" placeholder="z.B. Mein Pro Key" autocomplete="off">
<label>API-Key</label>
<input type="text" id="apiKeysKey" placeholder="sk-ant-..." autocomplete="off">
<div class="form-actions">
<button id="apiKeysFormSaveBtn">Erstellen</button>
</div>
</div>
</div>
</div>
</template>
<template id="tpl-admin">
<div class="page form-page">
<header>
@@ -642,6 +676,7 @@
<script src="js/pages/settings-page.js"></script>
<script src="js/pages/profile-page.js"></script>
<script src="js/pages/admin-page.js"></script>
<script src="js/pages/api-keys-page.js"></script>
<script src="js/pages/server-settings-page.js"></script>
<script src="js/pages/shared-page.js"></script>
<script src="js/app.js"></script>