| 42 | return base.build_page(renderer.parse(base.read_sim(game), tour.players), payload, renderer) |
| 43 | |
| 44 | def error_page(game, exc) -> str: |
| 45 | source = game.member or (game.path.name if game.path else "?") |
| 46 | return ( |
| 47 | '<!doctype html><meta charset="utf-8">' |
| 48 | "<body style='background:#0d1117;color:#e6edf3;font:14px system-ui;padding:24px'>" |
| 49 | f"<h2>Couldn't render round {game.round}, sim {game.sim}</h2>" |
| 50 | f"<p style='color:#8b949e'>source: <code>{html.escape(source)}</code></p>" |
| 51 | f"<pre style='color:#e5484d;white-space:pre-wrap'>{html.escape(type(exc).__name__)}: {html.escape(str(exc))}</pre>" |
| 52 | "<p><a style='color:#58a6ff' href='/'>← back to index</a></p></body>" |
| 53 | ) |
| 54 | |
| 55 | class Handler(BaseHTTPRequestHandler): |
| 56 | def do_GET(self): |