test(unraid): complete contract coverage and retain WS samples
This commit is contained in:
@@ -18,7 +18,7 @@ from pynvml import (nvmlDeviceGetHandleByIndex, nvmlDeviceGetMemoryInfo,
|
||||
nvmlDeviceGetName, nvmlDeviceGetTemperature, nvmlInit,
|
||||
NVML_TEMPERATURE_GPU)
|
||||
|
||||
from .core import BroadcastHub, LatestQueue
|
||||
from .core import BroadcastHub, LatestQueue, valid_bearer
|
||||
from .models import Models
|
||||
from .ndi import NDIReceiver
|
||||
from .offline_benchmark import run_offline_benchmark
|
||||
@@ -65,7 +65,7 @@ app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
|
||||
|
||||
|
||||
def authorized(authorization: str | None = Header(default=None)) -> None:
|
||||
if not authorization or not authorization.startswith("Bearer ") or not __import__("hmac").compare_digest(authorization[7:], token):
|
||||
if not valid_bearer(authorization, token):
|
||||
raise HTTPException(status_code=401, detail="unauthorized")
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ def metrics():
|
||||
@app.websocket("/v1/poses")
|
||||
async def poses(ws: WebSocket):
|
||||
auth = ws.headers.get("authorization", "")
|
||||
if not auth.startswith("Bearer ") or not __import__("hmac").compare_digest(auth[7:], token):
|
||||
if not valid_bearer(auth, token):
|
||||
await ws.close(code=4401); return
|
||||
await ws.accept(); q = hub.add()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user