Fix tor configuration append / graph visualization

This commit is contained in:
2025-11-09 14:45:01 +01:00
parent 04c04612a2
commit 3954954f86
3 changed files with 52 additions and 11 deletions

View File

@@ -1,7 +1,16 @@
<?php
require __DIR__ . '/../lib/app.php'; auth_require();
require __DIR__ . '/../lib/app.php';
auth_require();
header('Content-Type: application/json');
$path = "/var/lib/torpanel/stats.json";
if (!file_exists($path)) { echo json_encode(["data"=>[]]); exit; }
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
$path = '/var/lib/torpanel/stats.json';
if (!is_readable($path)) {
echo json_encode(['data' => []]);
exit;
}
$raw = file_get_contents($path);
echo $raw ?: json_encode(["data"=>[]]);
echo $raw !== false && $raw !== '' ? $raw : json_encode(['data' => []]);