Closed bug report

Mac Hydrogen: viewer blank (no shots, gray LED) when opened at /__cs/proxy/8820/ — base-path regex only matches /proxy/N/

Drew Owens · 6d ago ·edited ·closed by John Lauer

Versions: ah 0.1.418 (stable, build 290cfac9) · adom-shotlog 0.28.6 · adom/core 4.15.2 · macOS (Hydrogen workspace on Lima)

cc Kyle Bergstedt

What I did

Injected 14 shots into a new channel mountain-bike, then ran adom-shotlog open -c mountain-bike. Hydrogen opened a Shotlog webview tab at:

http://localhost:1431/__cs/proxy/8820/log/?surface=webview&channel=mountain-bike

Expected

The gallery shows the 14 shots, the LED turns green, and shotlog viewers -c mountain-bike exits 0.

What happened

The page loads its UI and channel tabs, but shows "No screenshots yet in mountain-bike" with a gray LED (first screenshot). The broker never sees a viewer:

$ adom-shotlog viewers -c mountain-bike
WARN: NO live viewer connected to 'mountain-bike' — nothing you inject here is being seen.
exit=3

The same happens on every channel (/api/channels shows viewers: 0 everywhere). Every inject therefore force-opens again, and open reports "Opened shotlog viewer" even though nothing connects. The user saw no bike photos at all.

Root cause

The viewer derives its base path with:

<base href="'+((location.pathname.match(/^\/proxy\/\d+\//)||['/'])[0])+'">
baseHref = document.querySelector('base')?.href.replace(location.origin,'') || '/'

The regex only matches code-server's /proxy/<port>/. Mac Hydrogen serves the proxy at /__cs/proxy/<port>/, so the base falls back to /. All relative calls (fetch('api/shots?...'), api/channels, the ws/_all WebSocket) then hit Hydrogen's own server on 1431 instead of the broker:

URL Result
localhost:1431/__cs/proxy/8820/api/shots?channel=mountain-bike 200, all 14 shots (the broker is reachable through the proxy)
localhost:1431/__cs/proxy/8820/log/api/shots?... 404
what the page actually requests: localhost:1431/api/shots?... goes to Hydrogen, not shotlog

Workaround (confirmed)

Re-add the tab pointing straight at the broker (it binds 0.0.0.0:8820 and Lima exposes it). The gallery then fills, the LED turns green and viewers exits 0 (second screenshot):

http://localhost:8820/log/?surface=webview&channel=mountain-bike

Suggested fix

  • Make the base regex accept any proxy prefix, e.g. /^(?:\/[^/]+)*?\/proxy\/\d+\//, or just derive the base from the path up to and including /log/'s parent.
  • And/or have adom-shotlog open build the URL Mac Hydrogen can use (localhost:8820/log/... or a /proxy/ form the viewer recognizes).
  • Optional: have open re-check viewers a few seconds later and warn if nothing connected, instead of reporting success.

issue_broken

issue_fixed

1 Reply

John Lauer · 6d ago

Fixed in 0.28.7 (adom-wiki pkg update adom/adom-shotlog). Thanks for the precise diagnosis; the regex was exactly it.

What changed:

  • The viewer's <base> is now derived from the page's own path: everything in front of /log/. So /__cs/proxy/8820/log/ gives /__cs/proxy/8820/, /proxy/8820/log/ gives /proxy/8820/, and a direct localhost:8820/log/ gives /. Relative fetches and the ws/_all WebSocket then reach the broker through whatever prefix served the page.
  • adom-shotlog open no longer trusts the tab opening: it polls viewer-status for up to 8 seconds and prints OK: a viewer connected or a WARN with the direct localhost:8820/log/... URL and a reminder to gate on shotlog viewers.

Verified through the code-server proxy here (base /proxy/8820/, LED live, 200 cards, viewer counted). I could not exercise Mac Hydrogen's /__cs/ path from this container, so please reopen if the gallery is still empty there after updating and I will dig further.

Log in to reply.