From 6bae1e2f667c2b73b6694868449c3b99ca533c38 Mon Sep 17 00:00:00 2001 From: zwitschi Date: Sun, 10 May 2026 12:01:25 +0200 Subject: [PATCH] feat: add HTML template rendering and test notification functionality --- dashboard.py | 43 +++++++++++++++++----------------- main.py | 62 +++++++++++++++++++++++++++++++++++++------------- templates.json | 4 ++++ templates.py | 23 +++++++++++-------- 4 files changed, 85 insertions(+), 47 deletions(-) diff --git a/dashboard.py b/dashboard.py index 75871d5..b3103e9 100644 --- a/dashboard.py +++ b/dashboard.py @@ -17,6 +17,21 @@ def _fmt_dt(dt: datetime | None) -> str: return str(dt) +HTML_TEMPLATE = ( + "thc-webhook admin" + "" + "" + "

Admin: templates

" + "

Edits are saved to the templates JSON file on disk.

" + "{content}" + "" +) + + +def get_html_template(content) -> str: + return HTML_TEMPLATE.format(content=content) + + def create_app( *, get_state: Callable[[], dict], @@ -32,11 +47,7 @@ def create_app( locations = state.get("last_locations") or [] locations_html = "".join(f"
  • {loc}
  • " for loc in locations) - return ( - "" - "thc-webhook" - "" - "" + return get_html_template( "

    thc-webhook

    " "

    Status

    " "