(request: Request, call_next)
| 352 | # locally regardless of this setting. |
| 353 | @app.middleware("http") |
| 354 | async def network_gate(request: Request, call_next): |
| 355 | if not get_allow_network(): |
| 356 | client_host = request.client.host if request.client else None |
| 357 | if not _is_host_request(client_host): |
| 358 | return PlainTextResponse( |
| 359 | "StemDeck is not available on the network. Enable it in Settings on the host machine.", |
| 360 | status_code=403, |
| 361 | ) |
| 362 | return await call_next(request) |
| 363 | |
| 364 | |
| 365 | app.include_router(router, prefix="/api") |
nothing calls this directly
no test coverage detected