From ea1c4835ec1fadfed275dde27c787d6ba04d6868 Mon Sep 17 00:00:00 2001 From: Michael Woods Date: Sun, 21 Dec 2025 22:31:39 -0500 Subject: [PATCH] dashboard update. --- packetserver/http/routers/dashboard.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packetserver/http/routers/dashboard.py b/packetserver/http/routers/dashboard.py index 449ef5e..8bebd37 100644 --- a/packetserver/http/routers/dashboard.py +++ b/packetserver/http/routers/dashboard.py @@ -4,16 +4,26 @@ from fastapi.responses import HTMLResponse from packetserver.http.dependencies import get_current_http_user from packetserver.http.auth import HttpUser -from packetserver.http.server import templates # for TemplateResponse +from packetserver.http.server import templates router = APIRouter(tags=["dashboard"]) +# Import the function at module level (safe now that circular import is fixed) +from packetserver.http.routers.messages import get_messages as api_get_messages + @router.get("/dashboard", response_class=HTMLResponse) -async def dashboard(request: Request, current_user: HttpUser = Depends(get_current_http_user)): - # Fetch messages via internal API call (reuse list logic) - from packetserver.http.routers.messages import get_messages as api_get_messages - messages_resp = await api_get_messages(current_user=current_user, type="all", limit=100) +async def dashboard( + request: Request, + current_user: HttpUser = Depends(get_current_http_user) +): + # Internal call – pass explicit defaults to avoid Query object injection + messages_resp = await api_get_messages( + current_user=current_user, + type="all", + limit=100, + since=None # prevents Query wrapper + ) messages = messages_resp["messages"] return templates.TemplateResponse(