Fix renderer list and enable markdown tables

- Fix get_user_renderers usage (returns strings not dicts)
- Enable tables and fenced_code markdown extensions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-01-11 13:20:47 +00:00
parent 0a15b2532e
commit dcb487e6f4
2 changed files with 8 additions and 6 deletions

View File

@@ -33,11 +33,13 @@ async def list_renderers(
"""List attached L1 renderers.""" """List attached L1 renderers."""
import db import db
renderers = await db.get_user_renderers(user["username"]) renderer_urls = await db.get_user_renderers(user["username"])
# Add status info # Convert to dicts with status info
for r in renderers: renderers = [
r["known"] = r["url"] in settings.l1_servers {"url": url, "known": url in settings.l1_servers}
for url in renderer_urls
]
if wants_json(request): if wants_json(request):
return {"renderers": renderers, "known_servers": settings.l1_servers} return {"renderers": renderers, "known_servers": settings.l1_servers}
@@ -67,7 +69,7 @@ async def attach_renderer(
# Check if already attached # Check if already attached
existing = await db.get_user_renderers(user["username"]) existing = await db.get_user_renderers(user["username"])
if l1_url in [r["url"] for r in existing]: if l1_url in existing:
raise HTTPException(400, "Renderer already attached") raise HTTPException(400, "Renderer already attached")
# Test connection # Test connection

View File

@@ -149,7 +149,7 @@ async def home(request: Request):
from pathlib import Path from pathlib import Path
readme_path = Path(__file__).parent.parent.parent / "README.md" readme_path = Path(__file__).parent.parent.parent / "README.md"
if readme_path.exists(): if readme_path.exists():
readme_html = markdown.markdown(readme_path.read_text()) readme_html = markdown.markdown(readme_path.read_text(), extensions=['tables', 'fenced_code'])
except Exception: except Exception:
pass pass