Add web client to app server
This commit is contained in:
@@ -99,6 +99,8 @@ async def health_check():
|
|||||||
return {"status": "healthy", "sessions": len(active_sessions)}
|
return {"status": "healthy", "sessions": len(active_sessions)}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/iceservers")
|
@app.get("/iceservers")
|
||||||
async def get_ice_servers():
|
async def get_ice_servers():
|
||||||
"""Get ICE servers configuration for WebRTC."""
|
"""Get ICE servers configuration for WebRTC."""
|
||||||
|
|||||||
28
app/web_client.py
Normal file
28
app/web_client.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
"""Static web client server (port 8100 by default)."""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from fastapi import FastAPI, HTTPException
|
||||||
|
from fastapi.responses import FileResponse
|
||||||
|
import uvicorn
|
||||||
|
|
||||||
|
WEB_CLIENT_PATH = Path(__file__).resolve().parent.parent / "examples" / "web_client.html"
|
||||||
|
|
||||||
|
app = FastAPI(title="Python Active-Call Web Client", version="0.1.0")
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def web_client():
|
||||||
|
"""Serve the web client."""
|
||||||
|
if not WEB_CLIENT_PATH.exists():
|
||||||
|
raise HTTPException(status_code=404, detail="Web client not found")
|
||||||
|
return FileResponse(WEB_CLIENT_PATH)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
uvicorn.run(
|
||||||
|
"app.web_client:app",
|
||||||
|
host="0.0.0.0",
|
||||||
|
port=8100,
|
||||||
|
reload=True,
|
||||||
|
log_level="info",
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user