mirror of
git://f0xx.org/ac/ac-ms-sfu-signaling
synced 2026-08-12 18:12:44 +03:00
SFU M0: browser lab E2E client for Janus VideoRoom.
Add lab page with screen-share publisher and subscriber viewer, join API feed support, shared session auth, static assets route, and lab docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,15 +4,23 @@ require_once dirname(__DIR__) . '/src/bootstrap.php';
|
||||
|
||||
/* ── Simple front-controller ─────────────────────────────────────── */
|
||||
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
|
||||
$script = basename($uri);
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
|
||||
|
||||
/* Strip project prefix /app/androidcast_project/sfu */
|
||||
$uri = preg_replace('#^/app/androidcast_project/sfu#', '', $uri);
|
||||
$uri = $uri === '' ? '/' : $uri;
|
||||
|
||||
if (preg_match('#^/api/rooms/\d+$#', $uri)) {
|
||||
require __DIR__ . '/api/rooms.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$routes = [
|
||||
'/' => 'dashboard.php',
|
||||
'/dashboard' => 'dashboard.php',
|
||||
'/dashboard.php' => 'dashboard.php',
|
||||
'/lab' => 'lab.php',
|
||||
'/lab.php' => 'lab.php',
|
||||
'/health' => 'health.php',
|
||||
'/health.php' => 'health.php',
|
||||
'/api/rooms' => 'api/rooms.php',
|
||||
@@ -28,6 +36,19 @@ if ($target && is_file(__DIR__ . '/' . $target)) {
|
||||
require __DIR__ . '/' . $target;
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Static assets under /assets/ */
|
||||
if (str_starts_with($uri, '/assets/')) {
|
||||
$file = __DIR__ . $uri;
|
||||
if (is_file($file)) {
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$types = ['js' => 'application/javascript', 'css' => 'text/css'];
|
||||
header('Content-Type: ' . ($types[$ext] ?? 'application/octet-stream'));
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
http_response_code(404);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['ok' => false, 'error' => 'not found']);
|
||||
|
||||
Reference in New Issue
Block a user