Iteration 1: - Dark theme with 3-way toggle - Dynamic heatmap gradient (blue→red) - Radius up to 100km - Save & Calculate workflow Iteration 2: - Terrain overlay toggle - Batch height operations - Zoom-dependent heatmap rendering Infrastructure: - Backend FastAPI on 8888 - Frontend static build via Caddy - Systemd services - Caddy reverse proxy integration
19 lines
637 B
Python
19 lines
637 B
Python
from contextlib import AsyncExitStack
|
|
|
|
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
|
|
|
|
# Used mainly to close files after the request is done, dependencies are closed
|
|
# in their own AsyncExitStack
|
|
class AsyncExitStackMiddleware:
|
|
def __init__(
|
|
self, app: ASGIApp, context_name: str = "fastapi_middleware_astack"
|
|
) -> None:
|
|
self.app = app
|
|
self.context_name = context_name
|
|
|
|
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
async with AsyncExitStack() as stack:
|
|
scope[self.context_name] = stack
|
|
await self.app(scope, receive, send)
|