mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
feat: Trickle ice candidates for faster WebRTC connection
This commit is contained in:
parent
4b4a7ba19a
commit
895af47482
8 changed files with 677 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from typing import Annotated, Optional
|
||||
|
||||
import httpx
|
||||
from fastapi import Header, HTTPException
|
||||
from fastapi import Header, HTTPException, Query, WebSocket
|
||||
from loguru import logger
|
||||
from pydantic import ValidationError
|
||||
|
||||
|
|
@ -328,3 +328,26 @@ async def get_superuser(
|
|||
)
|
||||
|
||||
return user
|
||||
|
||||
|
||||
async def get_user_ws(
|
||||
websocket: WebSocket,
|
||||
token: str = Query(None),
|
||||
) -> UserModel:
|
||||
"""
|
||||
WebSocket authentication dependency.
|
||||
Uses token from query parameters for authentication.
|
||||
"""
|
||||
if not token:
|
||||
await websocket.close(code=1008, reason="Missing authentication token")
|
||||
raise HTTPException(status_code=401, detail="Missing authentication token")
|
||||
|
||||
# Use the same logic as get_user but with token from query
|
||||
authorization = f"Bearer {token}"
|
||||
|
||||
try:
|
||||
user = await get_user(authorization)
|
||||
return user
|
||||
except HTTPException as e:
|
||||
await websocket.close(code=1008, reason=e.detail)
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue