- Implemented the InternalWHIP component for managing WHIP server configurations. - Added functionality to load live WHIP state from Core and handle OBS URL generation. - Included polling for active streams and notifying parent components of state changes. - Created comprehensive tests for the InternalWHIP component covering various scenarios including fallback mechanisms and state changes. test: add integration tests for WHIP source component - Developed end-to-end tests for the InternalWHIP component to verify its behavior under different configurations. - Ensured that the component correctly handles the loading of WHIP state, displays appropriate messages, and emits the correct onChange events. test: add Settings WHIP configuration tests - Implemented tests for the WHIP settings tab to validate loading and saving of WHIP configurations. - Verified that the correct values are sent back to the Core when the user saves changes. - Ensured that the UI reflects the current state of the WHIP configuration after Core restarts or changes.
117 lines
3.5 KiB
Caddyfile
117 lines
3.5 KiB
Caddyfile
{
|
|
# Deshabilitar HTTP/2 y HTTP/3 globalmente para soporte WebSocket
|
|
servers {
|
|
protocols h1 h2
|
|
}
|
|
}
|
|
|
|
:3000
|
|
|
|
encode zstd gzip
|
|
|
|
# ── Facebook OAuth2 microserver (Node.js en puerto 3002) ──────────────────────
|
|
handle /fb-server/* {
|
|
uri strip_prefix /fb-server
|
|
reverse_proxy 127.0.0.1:3002
|
|
}
|
|
|
|
# ── LiveKit token endpoint (Node.js en puerto 3002) ───────────────────────────
|
|
# POST /livekit/token → genera AccessToken JWT firmado
|
|
# GET /livekit/config → devuelve wsUrl público (sin secretos)
|
|
handle /livekit/* {
|
|
reverse_proxy 127.0.0.1:3002
|
|
}
|
|
|
|
# ── WebRTC relay WebSocket + status (Node.js en puerto 3002) ─────────────────
|
|
# 127.0.0.1 evita problema de resolución IPv6 en Alpine ("localhost" → ::1)
|
|
# HTTP/1.1 necesario para WebSocket upgrade (Caddy requiere versión explícita)
|
|
handle /webrtc-relay/* {
|
|
reverse_proxy 127.0.0.1:3002 {
|
|
transport http {
|
|
versions 1.1
|
|
}
|
|
}
|
|
}
|
|
|
|
# ── WebRTC Room HTML (sala para el presentador) ───────────────────────────────
|
|
# Sirve la página estática sin fallback al index.html de la SPA
|
|
handle /webrtc-room/* {
|
|
root * /ui/build
|
|
file_server
|
|
}
|
|
handle /webrtc-room {
|
|
redir /webrtc-room/ 302
|
|
}
|
|
|
|
# ── yt-dlp stream extractor (servicio externo configurable via env) ───────────
|
|
# /yt-stream/{VIDEO_ID} → http://YTDLP_HOST/stream/{VIDEO_ID}
|
|
# yt-dlp puede tardar 20-30s — timeouts extendidos a 120s
|
|
handle_path /yt-stream/* {
|
|
rewrite * /stream{path}
|
|
reverse_proxy {env.YTDLP_HOST} {
|
|
transport http {
|
|
dial_timeout 10s
|
|
response_header_timeout 120s
|
|
read_timeout 120s
|
|
}
|
|
}
|
|
}
|
|
|
|
# OAuth2 callback page — must be served as a static HTML (not the SPA index)
|
|
handle /oauth2callback {
|
|
rewrite * /oauth2callback.html
|
|
file_server {
|
|
root /ui/build
|
|
}
|
|
}
|
|
|
|
# Facebook OAuth2 callback popup — soporta tanto .html como .htm
|
|
# .html → servir directamente
|
|
handle /oauth/facebook/callback.html {
|
|
file_server {
|
|
root /ui/build
|
|
}
|
|
}
|
|
|
|
# .htm → reescribir internamente a .html (misma página, misma URL visible para Facebook)
|
|
handle /oauth/facebook/callback.htm {
|
|
rewrite * /oauth/facebook/callback.html
|
|
file_server {
|
|
root /ui/build
|
|
}
|
|
}
|
|
|
|
# Sin extensión → redirigir a .html
|
|
handle /oauth/facebook/callback {
|
|
redir /oauth/facebook/callback.html{query} 302
|
|
}
|
|
|
|
# ── LiveKit Ingress WHIP proxy: OBS publica vía WHIP al mismo dominio ─────────
|
|
# OBS usa: https://djmaster.nextream.sytes.net/w/<streamKey>
|
|
# Caddy lo reenvía al servicio livekit-ingress interno (solo accesible localmente).
|
|
# LIVEKIT_INGRESS_HOST se configura en docker-compose (p.ej. 192.168.1.20:8088).
|
|
handle /w/* {
|
|
reverse_proxy {env.LIVEKIT_INGRESS_HOST} {
|
|
header_up Host {upstream_hostport}
|
|
}
|
|
}
|
|
|
|
# ── WHIP info API: genera sesión Ingress (Node en :3002) ─────────────────────
|
|
handle /api/whip/* {
|
|
reverse_proxy 127.0.0.1:3002
|
|
}
|
|
|
|
# ── WHEP relay proxy: Core hace pull aquí → egress server ───────────────────
|
|
# Core input: https://djmaster.nextream.sytes.net/whep/rooms/<channelId>
|
|
# EGRESS_HOST se configura en docker-compose (URL del servidor egress).
|
|
handle /whep/* {
|
|
reverse_proxy {env.EGRESS_HOST}
|
|
}
|
|
|
|
# SPA — serve static files, fallback to index.html for client-side routing
|
|
handle {
|
|
root * /ui/build
|
|
try_files {path} /index.html
|
|
file_server
|
|
}
|