diff --git a/jtl-wafi-dashboard.py b/jtl-wafi-dashboard.py index 07dc413..9ef1cc2 100644 --- a/jtl-wafi-dashboard.py +++ b/jtl-wafi-dashboard.py @@ -31,7 +31,7 @@ import uvicorn # ============================================================================= # VERSION & CONFIG # ============================================================================= -VERSION = "2.3.0" +VERSION = "2.4.0" DATA_DIR = "/var/lib/jtl-wafi" SSL_DIR = "/var/lib/jtl-wafi/ssl" @@ -91,6 +91,7 @@ class ShopData: geo_region: str = "" rate_limit: int = 0 ban_duration: int = 0 + bot_monitor_only: bool = False link11: bool = False link11_ip: str = "" activated: str = "" @@ -254,6 +255,7 @@ class DataStore: shop.geo_region = shop_data.get('geo_region', '') shop.rate_limit = shop_data.get('rate_limit', 0) shop.ban_duration = shop_data.get('ban_duration', 0) + shop.bot_monitor_only = shop_data.get('bot_monitor_only', False) shop.link11 = bool(shop_data.get('link11')) shop.link11_ip = shop_data.get('link11_ip', '') shop.activated = shop_data.get('activated', '') @@ -330,6 +332,7 @@ class DataStore: 'geo_region': shop.geo_region, 'rate_limit': shop.rate_limit, 'ban_duration': shop.ban_duration, + 'bot_monitor_only': shop.bot_monitor_only, 'link11': shop.link11, 'link11_ip': shop.link11_ip, 'activated': shop.activated, @@ -864,12 +867,16 @@ async def activate_shop( mode: str = Form(...), geo_region: str = Form("dach"), rate_limit: int = Form(30), - ban_duration: int = Form(300) + ban_duration: int = Form(300), + bot_monitor_only: str = Form("false") ): user = await get_current_user(request) if not user: raise HTTPException(401) + # String "true"/"false" zu Boolean konvertieren + is_monitor_only = bot_monitor_only.lower() in ('true', '1', 'yes', 'on') + agent_id = manager.get_agent_for_shop(domain) if not agent_id or not manager.is_agent_connected(agent_id): return JSONResponse({"success": False, "error": "Agent nicht verbunden"}) @@ -882,8 +889,9 @@ async def activate_shop( 'shop': domain, 'mode': mode, 'geo_region': geo_region if mode == 'geoip' else None, - 'rate_limit': rate_limit if mode == 'bot' else None, - 'ban_duration': ban_duration if mode == 'bot' else None + 'rate_limit': rate_limit if mode == 'bot' and not is_monitor_only else None, + 'ban_duration': ban_duration if mode == 'bot' and not is_monitor_only else None, + 'bot_monitor_only': is_monitor_only if mode == 'bot' else False } }) @@ -916,12 +924,16 @@ async def bulk_activate( geo_region: str = Form("dach"), rate_limit: int = Form(30), ban_duration: int = Form(300), + bot_monitor_only: str = Form("false"), filter_type: str = Form("all") ): user = await get_current_user(request) if not user: raise HTTPException(401) + # String "true"/"false"/"on" zu Boolean konvertieren + is_monitor_only = bot_monitor_only.lower() in ('true', '1', 'yes', 'on') + activated = 0 shops = store.get_all_shops() @@ -946,8 +958,9 @@ async def bulk_activate( 'shop': shop['domain'], 'mode': mode, 'geo_region': geo_region if mode == 'geoip' else None, - 'rate_limit': rate_limit if mode == 'bot' else None, - 'ban_duration': ban_duration if mode == 'bot' else None + 'rate_limit': rate_limit if mode == 'bot' and not is_monitor_only else None, + 'ban_duration': ban_duration if mode == 'bot' and not is_monitor_only else None, + 'bot_monitor_only': is_monitor_only if mode == 'bot' else False } }) activated += 1 @@ -1269,15 +1282,15 @@ def get_dashboard_html() -> str:
πŸ“œ Live Logs: -
- - + + - +