(self)
| 25 | server_version = "LedgerForgeBenchmarkDashboard/1.0" |
| 26 | |
| 27 | def do_GET(self) -> None: # noqa: N802 |
| 28 | parsed = urlparse(self.path) |
| 29 | path = parsed.path |
| 30 | |
| 31 | if path in {"/", ""}: |
| 32 | self.redirect("/dashboard/") |
| 33 | return |
| 34 | if path == "/api/runs": |
| 35 | self.send_json({"runs": discover_runs(scan_root)}) |
| 36 | return |
| 37 | if path.startswith("/api/runs/"): |
| 38 | run_id = unquote(path.removeprefix("/api/runs/")) |
| 39 | self.handle_run(run_id) |
| 40 | return |
| 41 | if path == "/dashboard" or path == "/dashboard/": |
| 42 | self.serve_file(DASHBOARD_DIR / "index.html") |
| 43 | return |
| 44 | if path.startswith("/dashboard/"): |
| 45 | relative = Path(path.removeprefix("/dashboard/")) |
| 46 | target = (DASHBOARD_DIR / relative).resolve() |
| 47 | if DASHBOARD_DIR not in target.parents and target != DASHBOARD_DIR: |
| 48 | self.send_error(HTTPStatus.NOT_FOUND, "Not found") |
| 49 | return |
| 50 | self.serve_file(target) |
| 51 | return |
| 52 | |
| 53 | self.send_error(HTTPStatus.NOT_FOUND, "Not found") |
| 54 | |
| 55 | def log_message(self, format: str, *args) -> None: # noqa: A003 |
| 56 | return |
nothing calls this directly
no test coverage detected