fix: update TemplateResponse calls to Starlette 1.0.0 API to fix 500 error

Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/2ec7d964-c658-4489-9d06-9ea78596cddd

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-29 17:11:30 +00:00
parent 078e33d273
commit 2a2fc9bfd5
+10 -10
View File
@@ -171,34 +171,34 @@ templates = Jinja2Templates(directory=templates_dir)
@app.get("/", response_class=HTMLResponse) @app.get("/", response_class=HTMLResponse)
async def index(request: Request): async def index(request: Request):
return templates.TemplateResponse("index.html", {"request": request}) return templates.TemplateResponse(request, "index.html")
# Individual page routes # Individual page routes
@app.get("/dashboard", response_class=HTMLResponse) @app.get("/dashboard", response_class=HTMLResponse)
async def dashboard(request: Request): async def dashboard(request: Request):
return templates.TemplateResponse( return templates.TemplateResponse(
"dashboard.html", {"request": request, "app_name": settings.PROJECT_NAME} request, "dashboard.html", {"app_name": settings.PROJECT_NAME}
) )
@app.get("/login", response_class=HTMLResponse) @app.get("/login", response_class=HTMLResponse)
async def login(request: Request): async def login(request: Request):
return templates.TemplateResponse( return templates.TemplateResponse(
"login.html", {"request": request, "app_name": settings.PROJECT_NAME} request, "login.html", {"app_name": settings.PROJECT_NAME}
) )
@app.get("/setup", response_class=HTMLResponse) @app.get("/setup", response_class=HTMLResponse)
async def setup(request: Request): async def setup(request: Request):
return templates.TemplateResponse( return templates.TemplateResponse(
"setup.html", {"request": request, "app_name": settings.PROJECT_NAME} request, "setup.html", {"app_name": settings.PROJECT_NAME}
) )
@app.get("/domains", response_class=HTMLResponse) @app.get("/domains", response_class=HTMLResponse)
async def domains(request: Request): async def domains(request: Request):
return templates.TemplateResponse("domains.html", {"request": request}) return templates.TemplateResponse(request, "domains.html")
@app.get("/domain/{domain_id}", response_class=HTMLResponse) @app.get("/domain/{domain_id}", response_class=HTMLResponse)
@@ -210,15 +210,15 @@ async def domain_details(request: Request, domain_id: str):
if domain_id not in known_domains: if domain_id not in known_domains:
# Domain not found, redirect to domains list # Domain not found, redirect to domains list
return templates.TemplateResponse( return templates.TemplateResponse(
"domains.html", {"request": request, "error": f"Domain {domain_id} not found"} request, "domains.html", {"error": f"Domain {domain_id} not found"}
) )
domain_summary = store.get_domain_summary(domain_id) domain_summary = store.get_domain_summary(domain_id)
return templates.TemplateResponse( return templates.TemplateResponse(
request,
"domain_details.html", "domain_details.html",
{ {
"request": request,
"domain_id": domain_id, "domain_id": domain_id,
"domain": { "domain": {
"name": domain_id, "name": domain_id,
@@ -231,17 +231,17 @@ async def domain_details(request: Request, domain_id: str):
@app.get("/reports", response_class=HTMLResponse) @app.get("/reports", response_class=HTMLResponse)
async def reports(request: Request): async def reports(request: Request):
return templates.TemplateResponse("reports.html", {"request": request}) return templates.TemplateResponse(request, "reports.html")
@app.get("/settings", response_class=HTMLResponse) @app.get("/settings", response_class=HTMLResponse)
async def settings_page(request: Request): async def settings_page(request: Request):
return templates.TemplateResponse("settings.html", {"request": request}) return templates.TemplateResponse(request, "settings.html")
@app.get("/upload", response_class=HTMLResponse) @app.get("/upload", response_class=HTMLResponse)
async def upload_page(request: Request): async def upload_page(request: Request):
return templates.TemplateResponse("upload.html", {"request": request}) return templates.TemplateResponse(request, "upload.html")
@app.get("/health", status_code=200, tags=["health"]) @app.get("/health", status_code=200, tags=["health"])