diff --git a/backend/app/config/settings.py b/backend/app/config/settings.py index 640baa21..03f50093 100644 --- a/backend/app/config/settings.py +++ b/backend/app/config/settings.py @@ -33,10 +33,10 @@ FLASK_DEBUG = True SESSION_LIFETIME = timedelta(days=7) # SSL-Konfiguration -SSL_ENABLED = False +SSL_ENABLED = True SSL_CERT_PATH = "instance/ssl/myp.crt" SSL_KEY_PATH = "instance/ssl/myp.key" -SSL_HOSTNAME = "raspberrypi" +SSL_HOSTNAME = "localhost" # Scheduler-Konfiguration SCHEDULER_INTERVAL = 60 # Sekunden @@ -92,49 +92,21 @@ def get_ssl_context(): if not os.path.exists(SSL_CERT_PATH) or not os.path.exists(SSL_KEY_PATH): ensure_ssl_directory() - # Prüfen, ob wir uns im Entwicklungsmodus befinden + # Im Entwicklungsmodus versuchen wir, einfache Zertifikate zu erstellen if FLASK_DEBUG: - print("SSL-Zertifikate nicht gefunden. Erstelle selbstsignierte Zertifikate...") - - # Auf Windows prüfen - import platform - if platform.system() == "Windows": - # Unter Windows verwenden wir OpenSSL direkt über subprocess - import subprocess - try: - # Erstelle ein selbstsigniertes Zertifikat mit OpenSSL - ssl_cmd = [ - "openssl", "req", "-new", "-x509", "-newkey", "rsa:2048", - "-nodes", "-keyout", SSL_KEY_PATH, "-out", SSL_CERT_PATH, - "-days", "365", "-subj", f"/CN={SSL_HOSTNAME}" - ] - - result = subprocess.run(ssl_cmd, capture_output=True, text=True) - if result.returncode != 0: - print(f"Fehler beim Erstellen der SSL-Zertifikate: {result.stderr}") - - # Fallback: Generiere einfache Schlüssel mit Python - create_simple_ssl_cert() - - except Exception as e: - print(f"Fehler beim Ausführen von OpenSSL: {e}") - - # Fallback: Generiere einfache Schlüssel mit Python - create_simple_ssl_cert() - else: - # Unter Linux das vorhandene Skript verwenden - script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), - "install", "create_ssl_cert.sh") + print("SSL-Zertifikate nicht gefunden. Erstelle einfache selbstsignierte Zertifikate...") + try: + # Einfache Zertifikate mit Python erstellen + create_simple_ssl_cert() - # Ausführungsrechte setzen - if os.path.exists(script_path): - os.system(f"chmod +x {script_path}") - - # Zertifikate erstellen mit spezifischem Hostnamen - os.system(f"{script_path} -c {SSL_CERT_PATH} -k {SSL_KEY_PATH} -h {SSL_HOSTNAME}") - else: - print(f"WARNUNG: SSL-Zertifikat-Generator nicht gefunden: {script_path}") + # Prüfen, ob die Zertifikate erfolgreich erstellt wurden + if not os.path.exists(SSL_CERT_PATH) or not os.path.exists(SSL_KEY_PATH): + print("Konnte keine SSL-Zertifikate erstellen.") return None + + except Exception as e: + print(f"Fehler beim Erstellen der SSL-Zertifikate: {e}") + return None else: print("WARNUNG: SSL-Zertifikate nicht gefunden und Nicht-Debug-Modus. SSL wird deaktiviert.") return None diff --git a/backend/app/database/myp.db b/backend/app/database/myp.db index a4ba6d52..b24e1177 100644 Binary files a/backend/app/database/myp.db and b/backend/app/database/myp.db differ diff --git a/backend/app/static/css/admin.css b/backend/app/static/css/admin.css index 4c0988c1..b5326499 100644 --- a/backend/app/static/css/admin.css +++ b/backend/app/static/css/admin.css @@ -70,6 +70,27 @@ html.dark body .bg-white.dark\:bg-dark-card { background-color: #1e293b !important; } +/* Spezifischere Selektoren für das Admin-Panel im Dark Mode */ +body.dark .admin-container .bg-white.dark\:bg-dark-card { + background-color: #1e293b !important; +} + +body.dark #users-tab .bg-white.dark\:bg-dark-card, +body.dark #printers-tab .bg-white.dark\:bg-dark-card, +body.dark #scheduler-tab .bg-white.dark\:bg-dark-card, +body.dark #system-tab .bg-white.dark\:bg-dark-card, +body.dark #logs-tab .bg-white.dark\:bg-dark-card { + background-color: #1e293b !important; +} + +body.dark .admin-stats .stat-card { + background-color: #1e293b !important; +} + +body.dark .bg-slate-50.dark\:bg-slate-800 { + background-color: #0f172a !important; +} + /* Admin Panel Container */ .admin-container { max-width: 1280px; @@ -841,6 +862,38 @@ html.dark body .bg-white.dark\:bg-dark-card { } /* Additional utilities */ +.transition-colors { + transition-property: color, background-color, border-color; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 300ms; +} + +/* Tailwind Dark Mode Overrides */ +html.dark body [class*="dark\:bg-dark-card"] { + background-color: #1e293b !important; +} + +html.dark body [class*="dark\:bg-slate-800"] { + background-color: #0f172a !important; +} + +html.dark body [class*="dark\:bg-slate-700"] { + background-color: #1e293b !important; +} + +html.dark body div[class*="dark\:hover\:bg"] { + background-color: #1e293b !important; +} + +html.dark body tr[class*="dark\:hover\:bg"] { + background-color: #1e293b !important; +} + +html.dark body tr[class*="dark\:hover\:bg"]:hover { + background-color: #334155 !important; +} + +/* Ensure proper transition */ .transition-colors { transition-property: color, background-color, border-color; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); diff --git a/backend/app/templates/admin.html b/backend/app/templates/admin.html index 07b1aeff..6ad888d9 100644 --- a/backend/app/templates/admin.html +++ b/backend/app/templates/admin.html @@ -401,38 +401,38 @@