jtl-wafi-dashboard.py aktualisiert

This commit is contained in:
2025-12-30 13:43:36 +01:00
parent aa35c24819
commit 34af47ca71

View File

@@ -1,16 +1,18 @@
#!/usr/bin/env python3
"""
JTL-WAFi Dashboard v2.5.0 - WebSocket Real-Time Dashboard
JTL-WAFi Dashboard v3.0.0 - WebSocket Real-Time Dashboard
ÄNDERUNG v2.5: Country Rate-Limiting ersetzt GeoIP-Blocking!
Features:
- Bot Rate-Limiting: Bots nach Rate-Limit bannen
- Country Rate-Limiting: Länder nach Rate-Limit bannen
- Unlimitierte Länder: Definierte Länder werden nicht limitiert
- Monitor-Only Modus: Nur überwachen ohne zu blocken
- Auto-Update: Dashboard und Agents über Git aktualisieren
- PHP-FPM Restart: OPcache automatisch leeren
- Alle Agent/Shop-Daten im Memory
- DB nur für: Passwort, Tokens, Sessions
v2.5.0: Country Rate-Limiting Feature
v3.0.0: Auto-Update, FPM-Restart, Country-Detection Bugfix
"""
import os
@@ -34,7 +36,7 @@ import uvicorn
# =============================================================================
# VERSION & CONFIG
# =============================================================================
VERSION = "2.5.0"
VERSION = "3.0.0"
DATA_DIR = "/var/lib/jtl-wafi"
SSL_DIR = "/var/lib/jtl-wafi/ssl"
@@ -1356,7 +1358,7 @@ def get_dashboard_html() -> str:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JTL-WAFi Dashboard v2.5</title>
<title>JTL-WAFi Dashboard v3.0</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
@@ -1480,12 +1482,12 @@ def get_dashboard_html() -> str:
</head>
<body>
<header>
<div class="logo">🌍 JTL-<span>WAFi</span> <small style="font-size:11px;opacity:0.5">v2.5</small></div>
<div class="logo">🌍 JTL-<span>WAFi</span> <small style="font-size:11px;opacity:0.5">v3.0</small></div>
<div class="header-right">
<div class="clock" id="clock">--:--:--</div>
<div class="connection-status"><div class="status-dot" id="wsStatus"></div><span id="wsStatusText">Verbinde...</span></div>
<div style="display:flex;align-items:center;gap:8px"><span style="font-size:12px;color:var(--text-secondary)">Update:</span><select id="updateInterval" onchange="setUpdateInterval(this.value)" style="padding:4px 8px;border-radius:4px;border:1px solid var(--border);background:var(--card-bg);color:var(--text);font-size:12px"><option value="2000">2s</option><option value="5000">5s</option><option value="10000" selected>10s</option><option value="15000">15s</option></select></div><div style="display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;border:1px solid var(--border);background:var(--card-bg)"><label style="display:flex;align-items:center;gap:6px;cursor:pointer;font-size:12px;color:var(--text-secondary)" title="OPcache nach Aktivierung/Deaktivierung leeren"><input type="checkbox" id="autoFpmRestart" checked style="margin:0"><span>FPM-Restart</span></label></div>
<div class="update-dropdown" style="position:relative"><button class="btn-header" onclick="toggleUpdateDropdown()" id="updateDropdownBtn">🔄 v{VERSION}</button><div id="updateDropdownMenu" style="display:none;position:absolute;right:0;top:100%;margin-top:4px;background:var(--card-bg);border:1px solid var(--border);border-radius:8px;padding:8px 0;min-width:200px;z-index:1000;box-shadow:0 4px 12px rgba(0,0,0,0.3)"><button onclick="updateDashboard()" style="display:block;width:100%;text-align:left;padding:8px 16px;border:none;background:none;color:var(--text);cursor:pointer;font-size:13px" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background='none'">📊 Dashboard updaten</button><button onclick="updateAgents()" style="display:block;width:100%;text-align:left;padding:8px 16px;border:none;background:none;color:var(--text);cursor:pointer;font-size:13px" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background='none'">🖥️ Alle Agents updaten (<span id="agentCountDropdown">0</span>)</button></div></div>
<div class="update-dropdown" style="position:relative"><button class="btn-header" onclick="toggleUpdateDropdown()" id="updateDropdownBtn">🔄 v3.0</button><div id="updateDropdownMenu" style="display:none;position:absolute;right:0;top:100%;margin-top:4px;background:var(--card-bg);border:1px solid var(--border);border-radius:8px;padding:8px 0;min-width:200px;z-index:1000;box-shadow:0 4px 12px rgba(0,0,0,0.3)"><button onclick="updateDashboard()" style="display:block;width:100%;text-align:left;padding:8px 16px;border:none;background:none;color:var(--text);cursor:pointer;font-size:13px" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background='none'">📊 Dashboard updaten</button><button onclick="updateAgents()" style="display:block;width:100%;text-align:left;padding:8px 16px;border:none;background:none;color:var(--text);cursor:pointer;font-size:13px" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background='none'">🖥️ Alle Agents updaten (<span id="agentCountDropdown">0</span>)</button></div></div>
<div style="display:flex;gap:8px"><button class="btn-header" onclick="openPasswordModal()">🔑</button><a href="/logout" class="btn-header">Abmelden</a></div>
</div>
</header>
@@ -1602,7 +1604,7 @@ def get_dashboard_html() -> str:
def create_systemd_service():
service = """[Unit]
Description=JTL-WAFi Dashboard v2.5 (WebSocket)
Description=JTL-WAFi Dashboard v3.0 (WebSocket)
After=network.target
[Service]