(self)
| 557 | self._send_sse_event("error", {"ok": False, "error": str(exc)}) |
| 558 | |
| 559 | def do_GET(self) -> None: # noqa: N802 - stdlib hook |
| 560 | path, _query_params = _query(self.path) |
| 561 | if path.startswith("/api/"): |
| 562 | self._handle_api(GET_ROUTES) |
| 563 | return |
| 564 | if path in {"/", "/index.html"}: |
| 565 | self._send_file(STATIC_DIR / "index.html") |
| 566 | return |
| 567 | if path == "/favicon.ico": |
| 568 | self._send_file(STATIC_DIR / "favicon.svg") |
| 569 | return |
| 570 | requested = (STATIC_DIR / path.lstrip("/")).resolve() |
| 571 | try: |
| 572 | requested.relative_to(STATIC_DIR.resolve()) |
| 573 | except ValueError: |
| 574 | self._send_json({"ok": False, "error": "Invalid path"}, status=HTTPStatus.BAD_REQUEST) |
| 575 | return |
| 576 | self._send_file(requested) |
| 577 | |
| 578 | def do_POST(self) -> None: # noqa: N802 - stdlib hook |
| 579 | try: |
nothing calls this directly
no test coverage detected