fix: TemplateResponse API, auth fallback, drop environment_id from update_ticket MCP tool

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Welvaert ATA IT 2026-05-27 09:11:55 +02:00
parent 018f2f40a2
commit 92b3afe9d6
3 changed files with 20 additions and 27 deletions

View file

@ -34,7 +34,7 @@ async def root():
@app.get("/tickets", response_class=HTMLResponse, include_in_schema=False)
async def tickets_page(request: Request):
return templates.TemplateResponse(
"tickets.html", {"request": request, "active_page": "tickets"}
request, "tickets.html", {"active_page": "tickets"}
)

View file

@ -159,9 +159,7 @@ def make_router(api_key: str, get_db, require_user=None) -> APIRouter:
return {"username": "claude", "email": "claude@internal"}
if require_user is not None:
return require_user(request)
if not api_key:
return {"username": "local", "email": "local@localhost"}
raise HTTPException(401, "unauthorized")
# ── Environment endpoints ─────────────────────────────────────────────────

View file

@ -237,7 +237,6 @@ def update_ticket(
user: str = "",
parent_id: int = -1,
effort: int = -1,
environment_id: int = -1,
) -> dict:
"""
Update an existing homelab ticket. Only provided (non-empty) fields
@ -254,8 +253,6 @@ def update_ticket(
Omit (default -1) to leave unchanged.
effort: Effort rating 110; pass 0 to clear it.
Omit (default -1) to leave unchanged.
environment_id: Move ticket to a different environment by ID.
Omit (default -1) to leave unchanged.
"""
body = {}
if title: body["title"] = title
@ -267,8 +264,6 @@ def update_ticket(
body["parent_id"] = parent_id if parent_id > 0 else None
if effort >= 0:
body["effort"] = effort if effort > 0 else None
if environment_id >= 0:
body["environment_id"] = environment_id if environment_id > 0 else None
if not body:
raise ValueError("Provide at least one field to update")
with _client() as c: