fix: исправлен синтаксис index.php и добавлен API маршрут дашборда

- Восстановлен корректный index.php из чистого коммита
- Добавлен маршрут /api/dashboard/stats для бесшовного обновления
- Исправлена ошибка парсинга PHP
This commit is contained in:
mirivlad 2026-04-14 00:52:53 +08:00
parent 8d4a789e00
commit 9a4106a201
1 changed files with 5 additions and 3 deletions

View File

@ -141,9 +141,6 @@ $dashboardGroup = $app->group('', function ($group) use ($twig) {
return $twig->render($response, 'dashboard.twig', $templateData); return $twig->render($response, 'dashboard.twig', $templateData);
}); });
})->add($csrfMiddleware)->add(AuthMiddleware::class); })->add($csrfMiddleware)->add(AuthMiddleware::class);
n// API для дашборда
= new DashboardController();
->get('/api/dashboard/stats', [, 'getDashboardData']);
// Create controllers BEFORE routes // Create controllers BEFORE routes
$groupController = new GroupController($twig); $groupController = new GroupController($twig);
@ -154,6 +151,11 @@ $adminController = new AdminController($twig);
$metricsController = new MetricsController(); $metricsController = new MetricsController();
$agentController = new AgentController(); $agentController = new AgentController();
// API для дашборда
$dashboardApiController = new DashboardController($twig);
$app->get('/api/dashboard/stats', [$dashboardApiController, 'getDashboardData'])->add(AuthMiddleware::class);
// Routes for groups (protected with auth middleware and csrf) // Routes for groups (protected with auth middleware and csrf)
$groupsGroup = $app->group('/groups', function ($group) use ($groupController) { $groupsGroup = $app->group('/groups', function ($group) use ($groupController) {
$group->get('', [$groupController, 'index']); $group->get('', [$groupController, 'index']);