Files
ac-ms-sfu-signaling/public/index.php
2026-07-04 11:17:24 +02:00

34 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/src/bootstrap.php';
/* ── Simple front-controller ─────────────────────────────────────── */
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
$script = basename($uri);
/* Strip project prefix /app/androidcast_project/sfu */
$uri = preg_replace('#^/app/androidcast_project/sfu#', '', $uri);
$routes = [
'/' => 'dashboard.php',
'/dashboard' => 'dashboard.php',
'/dashboard.php' => 'dashboard.php',
'/health' => 'health.php',
'/health.php' => 'health.php',
'/api/rooms' => 'api/rooms.php',
'/api/rooms.php' => 'api/rooms.php',
'/api/join' => 'api/join.php',
'/api/join.php' => 'api/join.php',
'/api/stats' => 'api/stats.php',
'/api/stats.php' => 'api/stats.php',
];
$target = $routes[$uri] ?? null;
if ($target && is_file(__DIR__ . '/' . $target)) {
require __DIR__ . '/' . $target;
exit;
}
http_response_code(404);
header('Content-Type: application/json');
echo json_encode(['ok' => false, 'error' => 'not found']);