Files
rpi-tor-relay-panel/web/api/stats.php

16 lines
423 B
PHP

<?php
require __DIR__ . '/../lib/app.php';
auth_require();
header('Content-Type: application/json');
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 !== false && $raw !== '' ? $raw : json_encode(['data' => []]);