diff --git a/JOURNAL.md b/JOURNAL.md index 5fdd62d..0daa45a 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -1,5 +1,41 @@ # v2-Docker Projekt Journal +## Letzte Änderungen (22.06.2025 - 13:07 Uhr) + +### Doppeltes API Key System entfernt ✅ + +**Problem:** +- Zwei verschiedene API Keys wurden angezeigt: + - `system_api_key` Tabelle: Globaler System API Key + - `client_configs` Tabelle: Account Forger spezifischer API Key +- Verwirrung welcher Key verwendet werden soll + +**Lösung:** +- Da Admin Panel exklusiv für Account Forger ist, nur noch ein API Key System +- `api_key` Spalte aus `client_configs` entfernt +- UI zeigt nur noch den System API Key als "API Key für Account Forger" +- License Server validiert bereits gegen `system_api_key` + +**Geänderte Dateien:** +- `templates/license_config.html` - Entfernt doppelte API Key Anzeige +- `migrations/remove_duplicate_api_key.sql` - Migration erstellt +- Datenbank aktualisiert + +### Orphaned API Tabellen entfernt ✅ + +**Entfernte Tabellen:** +- `api_keys` - Ungenutzte API Key Tabelle (war leer) +- `api_clients` - Alternative API Client Verwaltung (war leer) +- `rate_limits` - Abhängige Tabelle (war leer) +- `license_events` - Abhängige Tabelle (war leer) + +**Resultat:** +- Nur noch `system_api_key` Tabelle existiert +- Keine verwirrenden Duplikate mehr +- Saubere, eindeutige API Key Verwaltung + +--- + ## Letzte Änderungen (22.06.2025 - 12:18 Uhr) ### Lizenzserver Session Management - Vollständig implementiert ✅ diff --git a/v2_adminpanel/migrations/cleanup_orphaned_api_tables.sql b/v2_adminpanel/migrations/cleanup_orphaned_api_tables.sql new file mode 100644 index 0000000..1f5f222 --- /dev/null +++ b/v2_adminpanel/migrations/cleanup_orphaned_api_tables.sql @@ -0,0 +1,17 @@ +-- Cleanup orphaned API-related tables +-- Since admin panel is exclusively for Account Forger, we only need system_api_key table + +-- Drop tables that depend on api_clients +DROP TABLE IF EXISTS rate_limits CASCADE; +DROP TABLE IF EXISTS license_events CASCADE; + +-- Drop orphaned API tables +DROP TABLE IF EXISTS api_clients CASCADE; +DROP TABLE IF EXISTS api_keys CASCADE; + +-- Add comments to document the single API key system +COMMENT ON TABLE system_api_key IS 'Single API key table for Account Forger authentication. This is the ONLY API key system in use.'; + +-- Log the cleanup +INSERT INTO audit_log (username, action, entity_type, details, ip_address) +VALUES ('SYSTEM', 'CLEANUP', 'database', 'Removed orphaned API tables: api_keys, api_clients, rate_limits, license_events', '127.0.0.1'); \ No newline at end of file diff --git a/v2_adminpanel/migrations/remove_duplicate_api_key.sql b/v2_adminpanel/migrations/remove_duplicate_api_key.sql new file mode 100644 index 0000000..9c52187 --- /dev/null +++ b/v2_adminpanel/migrations/remove_duplicate_api_key.sql @@ -0,0 +1,9 @@ +-- Remove duplicate API key from client_configs table +-- Since admin panel is exclusively for Account Forger, we only need system_api_key + +-- Remove the api_key column from client_configs +ALTER TABLE client_configs DROP COLUMN IF EXISTS api_key; + +-- Update description +COMMENT ON TABLE client_configs IS 'Configuration for Account Forger client (versions, timeouts)'; +COMMENT ON TABLE system_api_key IS 'Single API key for Account Forger authentication'; \ No newline at end of file diff --git a/v2_adminpanel/routes/admin_routes.py b/v2_adminpanel/routes/admin_routes.py index 947410c..89ea86b 100644 --- a/v2_adminpanel/routes/admin_routes.py +++ b/v2_adminpanel/routes/admin_routes.py @@ -934,7 +934,7 @@ def license_config(): # Get client configuration cur.execute(""" - SELECT id, client_name, api_key, heartbeat_interval, session_timeout, + SELECT id, client_name, heartbeat_interval, session_timeout, current_version, minimum_version, created_at, updated_at FROM client_configs WHERE client_name = 'Account Forger' diff --git a/v2_adminpanel/templates/license_config.html b/v2_adminpanel/templates/license_config.html index f3be6f1..82ce1c3 100644 --- a/v2_adminpanel/templates/license_config.html +++ b/v2_adminpanel/templates/license_config.html @@ -21,26 +21,15 @@
-
- -
- - {% if client_config %} - - {% endif %} -
-
@@ -103,10 +92,14 @@
-
System API Key
+
API Key für Account Forger
{% if system_api_key %} +
+ Dies ist der einzige API Key, den Account Forger benötigt. + Verwenden Sie diesen Key im Header X-API-Key für alle API-Anfragen. +