MCPcopy Create free account
hub / github.com/stemdeckapp/stemdeck / network_gate

Function network_gate

app/main.py:354–362  ·  view source on GitHub ↗
(request: Request, call_next)

Source from the content-addressed store, hash-verified

352# locally regardless of this setting.
353@app.middleware("http")
354async 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
365app.include_router(router, prefix="/api")

Callers

nothing calls this directly

Calls 2

get_allow_networkFunction · 0.90
_is_host_requestFunction · 0.85

Tested by

no test coverage detected