mirror of
git://f0xx.org/ac/ac-ms-graphs
synced 2026-07-29 02:18:04 +03:00
23 lines
517 B
PHP
23 lines
517 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/../../src/bootstrap.php';
|
|
|
|
Auth::check();
|
|
|
|
$days = (int) ($_GET['days'] ?? 14);
|
|
if ($days <= 0) {
|
|
$days = 14;
|
|
}
|
|
|
|
try {
|
|
$payload = GraphRepository::dashboardData($days);
|
|
json_out(['ok' => true, 'data' => $payload]);
|
|
} catch (Throwable $e) {
|
|
error_log('graphs api: ' . $e->getMessage());
|
|
$out = ['ok' => false, 'error' => 'graphs_load_failed'];
|
|
if (cfg('debug')) {
|
|
$out['hint'] = $e->getMessage();
|
|
}
|
|
json_out($out, 500);
|
|
}
|