Show the console's version, and the hub's, in the footer
Claude · 2026-10-25 · 4bfa8e841fd0206678c83e95ef3b67a5e2bd407b · parents 7d52a30
The footer names the version the console was built from; once connected, it adds the hub's or service's version from /api, so a console hosted at pyrtan.com and the swarm it talks to can be told apart.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YChr78vDHtQJ15HNbsaRLZ
Changes
src/pyrtan/page.py | 7 +++++-- tests/test_service_hub.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/pyrtan/page.py b/src/pyrtan/page.py index c38bfc3..2cb70b2 100644 --- a/src/pyrtan/page.py +++ b/src/pyrtan/page.py@@ -18,6 +18,8 @@ console's origin with ``--cors``. No external assets, no build step.from __future__ import annotations+from . import __version__+PAGE = r"""<!doctype html> <html lang="en"> <head>@@ -138,7 +140,7 @@ GET /peers (hub only)</pre></div> </section>- <footer><a href="https://pyrtan.com">pyrtan.com</a> · <a href="https://github.com/b-i-t-8/pyrtan">source</a> · AGPL-3.0-or-later</footer>+ <footer><a href="https://pyrtan.com">pyrtan.com</a> · <a href="https://github.com/b-i-t-8/pyrtan">source</a> · AGPL-3.0-or-later · console v__VERSION__<span id="hub-version"></span></footer></main> <script> const $ = (s) => document.querySelector(s);@@ -228,6 +230,7 @@ async function load() {if (!a) { $("#who").textContent = remote ? "not connected" : "unreachable"; return; } $("#peers-tab").hidden = !isHub; $("#where").textContent = (base || location.origin) + (a.auth === "bearer" ? " · token" : "");+ $("#hub-version").textContent = a.version ? ` · ${a.pyrtan} v${a.version}` : "";try { const h = await json("health"); $("#who").textContent = (h.name ? h.name + " · " : "") + (h.peers != null ? `${h.up}/${h.peers} peers up` + (h.trees != null ? `, ${h.trees} trees` : "") : (h.trees ? `${h.trees.length} trees` : ""));@@ -317,4 +320,4 @@ load();</script> </body> </html>-"""+""".replace("__VERSION__", __version__)diff --git a/tests/test_service_hub.py b/tests/test_service_hub.py index ad07a2e..22cc73b 100644 --- a/tests/test_service_hub.py +++ b/tests/test_service_hub.py@@ -7,7 +7,7 @@ import urllib.requestimport pytest-from pyrtan import Registry, RecordedTransport+from pyrtan import Registry, RecordedTransport, __version__from pyrtan.hub import Hub from pyrtan.service import Server, Service, http_json from pyrtan.tree import load_tree_text@@ -200,7 +200,8 @@ def test_demo_page_is_served_by_service_and_hub(example_service):_, server = example_service with urllib.request.urlopen(f"{server.url}/") as resp: assert resp.headers.get_content_type() == "text/html"- assert b"<title>Pyrtan</title>" in resp.read()+ page = resp.read()+ assert b"<title>Pyrtan</title>" in page and f"console v{__version__}".encode() in pagestatus, api = http_json("GET", f"{server.url}/api") assert status == 200 and api["pyrtan"] == "service" hub = Hub()