* feat(dashboard): name the Webapp in /api/status on a hosted agent's dashboard webapp_url is set only for a signed-in caller of a Hermes Cloud agent's standalone dashboard whose config has the Webapp on; never on a loopback bind and never from the Webapp itself. * feat(web): 'your dashboard is moving' modal on Hermes Cloud dashboards A blocking modal (no backdrop or Escape dismissal) shown when /api/status carries webapp_url. 'Open in web app' goes to the agent's Webapp; 'Later' hides it for the browser session. * refactor(web): status wire types and the shell's notices get their own modules Keeps api.ts and App under their code-health caps; the status helper drops its catch-all. * docs(web): drop the design reference from the modal's comment * fix(web): modal type matches the design's sizes and tracking The actions inherited the DS button's 0.2em tracking, bold mono and 15px size; body and row titles rendered at the dashboard's 15px base. * fix(web): modal actions use the stock button; headline is set in Oswald Reverts the label overrides on the two actions. The headline loads Oswald Light from Google Fonts when the modal opens, as the theme fonts do. * fix(dashboard): name the Webapp only while the gateway is serving it webapp_url now needs the gateway to report the Webapp listener serving on the configured port, so the modal never sends anyone to a Webapp that is down, starting or not yet restarted onto its config. The gateway is asked only for a signed-in caller of a gated dashboard, never for the anonymous health probes. * feat(dashboard): sign-in pages use Oswald and Mona Sans from Google Fonts The login, sign-in-unavailable and token-gated pages drop their Collapse and Rules @font-face rules. Their fonts are absolute URLs now, so the proxy prefix no longer rewrites any. * refactor(web): the modal headline uses the dashboard's Oswald * feat(dashboard): /api/status reports the Webapp's state on every Hermes Cloud dashboard webapp_state is ready, starting, down or not_available; webapp_url is still sent only while the gateway serves the Webapp. Cloud is the Portal's HERMES_HOSTING stamp, or the hosted /opt/data layout with the Webapp configured: the Docker image shares that layout, so an agent with the Webapp off counts as Cloud only when stamped. * feat(web): the moving modal shows on every Hermes Cloud dashboard, with the web app's state The machine row reads Ready, Starting, Offline or Not available yet. The way into the web app and its settings row are offered only while it is ready; otherwise Later is the only action. * fix(web): the dashboard retires on December 6, 2026
41 lines
2.1 KiB
Python
41 lines
2.1 KiB
Python
"""Static asset lookups the SPA catch-all must not answer with ``index.html``.
|
|
|
|
The dashboard loads Mondwest and the terminal face from ``/fonts/`` and ``/fonts-terminal/``. Those
|
|
files ship in the dashboard's ``web/public`` tree, which the dashboard build copies into its own
|
|
dist, but the Webapp serves ``apps/desktop/dist-webapp`` and has no ``fonts/`` dir. A font missing
|
|
from the served dist is read from the packaged dashboard dist (``HERMES_WEB_DIST`` / ``web_dist``,
|
|
which is all a Nix or wheel install ships, since those exclude ``web/``), then from a source
|
|
checkout's ``web/public``.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from hermes_cli._startup_fast import project_root_str
|
|
|
|
# Requests under these prefixes are files, never client-side routes, so a miss is a 404 rather
|
|
# than the SPA shell (a font answered with HTML renders in a fallback face, silently).
|
|
STATIC_ASSET_PREFIXES: tuple[str, ...] = ("assets/", "ds-assets/", "fonts/", "fonts-terminal/")
|
|
# Root page icons answer without sign-in, so a missing (or out-of-dist) icon must be a 404, not
|
|
# the SPA shell served anonymously.
|
|
STATIC_ASSET_FILES: frozenset[str] = frozenset({"apple-touch-icon.png", "favicon.ico"})
|
|
_PUBLIC_FONT_DIRS: tuple[str, ...] = ("fonts", "fonts-terminal")
|
|
_WEB_PUBLIC = Path(project_root_str()) / "web" / "public"
|
|
|
|
|
|
def is_static_asset_path(full_path: str) -> bool:
|
|
return full_path in STATIC_ASSET_FILES or full_path.startswith(STATIC_ASSET_PREFIXES)
|
|
|
|
|
|
def public_font_file(dist: Path, dashboard_dist: Path, full_path: str) -> Path | None:
|
|
"""The served dist's copy of ``fonts/<name>`` (or ``fonts-terminal/<name>``), else the packaged
|
|
dashboard dist's, else the ``web/public`` copy the dashboard build takes it from; ``None`` when
|
|
none has it."""
|
|
folder, _, name = full_path.partition("/")
|
|
if folder not in _PUBLIC_FONT_DIRS or not name:
|
|
return None
|
|
for root in (dist / folder, dashboard_dist / folder, _WEB_PUBLIC / folder):
|
|
candidate = root / name
|
|
if candidate.is_file() and candidate.resolve().is_relative_to(root.resolve()):
|
|
return candidate
|
|
return None
|