refactor form for blocklist download

This commit is contained in:
carnivuth
2026-01-27 17:42:20 +01:00
parent b09fea7dfe
commit ebbf12ecae

View File

@@ -9,6 +9,11 @@ import html
from datetime import datetime from datetime import datetime
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
# imports for the __init_subclass__ method, do not remove pls
from firewall import fwtype
from firewall.iptables import Iptables
from firewall.raw import Raw
def _escape(value) -> str: def _escape(value) -> str:
"""Escape HTML special characters to prevent XSS attacks.""" """Escape HTML special characters to prevent XSS attacks."""
@@ -614,11 +619,13 @@ def generate_dashboard(stats: dict, dashboard_path: str = "") -> str:
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="download-section"> <form class="download-section" action="{dashboard_path}/api/get_banlist" method="GET" >
<a href="{dashboard_path}/api/download/malicious_ips.txt" class="download-btn" download> <select class="download-btn" name="fwtype" id="fwtype">
Export Malicious IPs <option value="raw">raw</option>
</a> <option value="iptables">iptables</option>
</div> </select>
<input type="submit" class="download-btn" value="Export IPs Banlist">
</form>
<h1>Krawl Dashboard</h1> <h1>Krawl Dashboard</h1>
<div class="stats-grid"> <div class="stats-grid">