diff --git a/authoring_server.py b/authoring_server.py index 28b4ca8..ebfd007 100755 --- a/authoring_server.py +++ b/authoring_server.py @@ -397,6 +397,18 @@ def page_to_dict(page: ContentPage) -> dict[str, Any]: } +def server_diagnostics() -> dict[str, Any]: + pages = list_pages() + return { + "root": ROOT.as_posix(), + "cwd": Path.cwd().as_posix(), + "executable": sys.executable, + "pid": os.getpid(), + "pageCount": len(pages), + "firstPage": pages[0]["path"] if pages else "", + } + + def list_pages() -> list[dict[str, Any]]: pages = [] org_paths = [] @@ -1355,6 +1367,12 @@ class Handler(BaseHTTPRequestHandler): except Exception as exc: self.send_json({"error": str(exc)}, HTTPStatus.INTERNAL_SERVER_ERROR) return + if parsed.path == "/api/diagnostics": + try: + self.send_json(server_diagnostics()) + except Exception as exc: + self.send_json({"error": str(exc)}, HTTPStatus.INTERNAL_SERVER_ERROR) + return if parsed.path == "/api/page": query = parse_qs(parsed.query) try: @@ -1408,8 +1426,12 @@ class Handler(BaseHTTPRequestHandler): def main() -> None: port = int(os.environ.get("AUTHOR_PORT", "8765")) server = ThreadingHTTPServer(("127.0.0.1", port), Handler) + page_count = len(list_pages()) print(f"Authoring UI running at http://127.0.0.1:{port}") print(f"Content root: {ROOT}") + print(f"Editable pages: {page_count}") + if page_count == 0: + print("WARNING: no editable pages were found. Check AUTHOR_ROOT and the launch directory.") print("Press Ctrl-C to stop.") try: server.serve_forever() diff --git a/posts/posts-list.org b/posts/posts-list.org index cc49ae4..4319789 100755 --- a/posts/posts-list.org +++ b/posts/posts-list.org @@ -4,7 +4,7 @@ See the categories: @@html:Categories@@ * Posts: -- [[file:career/career-list.org][Career List]] @@html:07-05-2026 16:35@@ +- [[file:career/career-list.org][Career List]] @@html:07-05-2026 16:45@@ - [[file:posts-list.sync-conflict-20260417-233432-VT6366A.org][Posts List]] @@html:14-04-2026 16:36@@ - [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:11-03-2026 17:18@@ @@html:learning@@ @@html:notes@@ - [[file:career/javascript.org][Understands the Javascript language]] @@html:11-03-2026 16:52@@ @@html:learning@@ @@html:notes@@ diff --git a/sitemap.org b/sitemap.org index a3e59e4..2789160 100755 --- a/sitemap.org +++ b/sitemap.org @@ -11,12 +11,12 @@ - [[file:tags/notes.org][Tag: notes]] - [[file:tags/review.org][Tag: review]] - [[file:tags/website.org][Tag: website]] + - [[file:tags/update.org][Tag: update]] - [[file:tags/life.org][Tag: life]] - [[file:tags/education.org][Tag: education]] - - [[file:tags/update.org][Tag: update]] - [[file:tags/insights.org][Tag: insights]] - - [[file:tags/emacs.org][Tag: emacs]] - [[file:tags/reading.org][Tag: reading]] + - [[file:tags/emacs.org][Tag: emacs]] - [[file:tags/maths.org][Tag: maths]] - home - [[file:home/countdown.org][Countdown]] diff --git a/tests/test_authoring_server.py b/tests/test_authoring_server.py index b75b532..fe11075 100755 --- a/tests/test_authoring_server.py +++ b/tests/test_authoring_server.py @@ -198,6 +198,15 @@ class PageRenderingTests(AuthoringServerTestCase): self.assertEqual(paths, ["blogs/keep.org"]) + def test_server_diagnostics_reports_root_and_page_count(self): + (self.blogs / "keep.org").write_text("#+TITLE: Keep\n#+DATE: <2026-05-07 Thu 12:00>\n", encoding="utf-8") + + diagnostics = server.server_diagnostics() + + self.assertEqual(diagnostics["root"], self.root.as_posix()) + self.assertEqual(diagnostics["pageCount"], 1) + self.assertEqual(diagnostics["firstPage"], "blogs/keep.org") + def test_relative_asset_path_is_calculated_from_lima_page_directory(self): self.assertEqual( server.relative_asset_path("lima/family/update.md", "assets/images/hzone/pic.png"),