diff --git a/api.php b/api.php index 88fd5c2..199e5d0 100644 --- a/api.php +++ b/api.php @@ -5,6 +5,17 @@ $db_file = __DIR__ . '/status.sqlite'; $pdo = new PDO('sqlite:' . $db_file); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +// --- Manuelle Bereinigung per Frontend --- +if (isset($_GET['action']) && $_GET['action'] === 'cleanup') { + // FEHLER BEHOBEN: Es muss $pdo heißen, nicht $db! + // Zeitabgleich gefixt: Wir nutzen datetime('now', '-2 minutes'), da der INSERT auch in UTC erfolgt. + $pdo->exec("DELETE FROM nodes WHERE last_seen < datetime('now', '-1 days')"); + + header('Content-Type: application/json'); + echo json_encode(["status" => "success"]); + exit; +} + // Tabelle erstellen, falls nicht existent $pdo->exec("CREATE TABLE IF NOT EXISTS nodes ( id INTEGER PRIMARY KEY AUTOINCREMENT, diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..8ca152d Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html index a171d7c..392c8cb 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,12 @@
-
+