GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: make pairing QR codes https links any camera opens by kitlangton · Pull Request #59962 · anomalyco/opencode Conversation
|
| Case | Before | After |
|---|---|---|
| iPhone Camera scans the desktop QR code | ❌ shows text | ✅ opens the app (link form the app already handles) |
TUI /pair on a server listening on all addresses |
❌ 127.0.0.1 link |
✅ network and remote addresses |
| App scanner reads a new QR code | n/a | ✅ |
| 84 container bridge addresses | ❌ QR encode throws, links hidden | ✅ QR with the LAN, tailnet and remote addresses |
| QR taller than an 80×36 terminal | ❌ clipped | ✅ scrolls |
--remote timing, measured with the OpenTunnel client in a clean profile: first setup waited 58–61 s for the certificate (twice); attaching the route afterwards took 0.3–0.5 s, including right after a holder process was killed. So the wait is a one-time certificate issue on OpenTunnel's side, not something pairing does; this PR only makes it visible.
👀 Read: packages/util/src/pairing-link.ts, the new shared encoder and decoder, and the TUI width check in dialog-pair.tsx (the QR code grows with each address, so it moves under the links, scrolls, or asks for a wider terminal rather than being clipped). The rest is routine.
Follows up #58540 and the iOS app's existing opencode.ai/pair support · supersedes the QR part of #54051 · timings measured on a Mac with a throwaway OpenTunnel profile
bun test src/pairing-link.test.ts (util): 7 passbun test … src/servers/connect/ (app): 7 passbun test src/pairing (gui-plugins): 3 passbun test test/pair-qr.test.ts test/pair-remote-consent.test.ts (cli): 7 passbun test test/component/dialog-pair.test.tsx (tui): 2 passbun run typecheck in util, app, cli, tui, gui-plugins: no errorsAdded by the opencode bot (AI-generated).
Fixes #58810
Public API: pairing QR payload changes from {"code","urls"} JSON to an https://opencode.ai/pair# link (new scanners read both; older app scanners can't read new codes)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Works as described for the scanner and CLI/TUI encoding. I drove /pair in the TUI on the base and with this PR (screenshots below). On the base the QR code is the unreachable 127.0.0.1 link; with the PR it is dropped and the dialog says how to add a reachable address. The new util, app, cli and tui tests pass. tsc --noEmit is clean in the changed files: cli and tui have the same pre-existing errors as the base, and util, app and gui-plugins are clean. I couldn't check the iPhone Camera hand-off or the --remote spinner here.
Public API: the QR payload changes from bare {"code","urls"} JSON to https://opencode.ai/pair#<base64url JSON>. The scanner in this version still accepts the old JSON. Older app scanners won't read the new codes until they update. CLI flags, the server API and config are unchanged.
Two things worth fixing before merge (details inline):
/pair route. So Android / Google Lens, and iPhones without the app, now open an opencode.ai 404 where they used to see text./pair dialog now stretches to nearly the full terminal height. The body is always a scrollbox with maxHeight, and it seems to fill that height. With only loopback addresses (the default), the dialog is mostly empty space and pinned to the top, where it used to be compact and centered (see screenshots).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // Pairing QR codes open this page. opencode.ai serves an apple-app-site-association file that lets the OpenCode iOS | ||
| // app claim it, so any camera app opens the code in the app. The single-use code and the server addresses ride in the | ||
| // fragment as base64url {"code","urls"} JSON, which a browser never sends to a server. | ||
| const PAGE = "https://opencode.ai/pair" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
packages/console/app serves the apple-app-site-association file for /pair, but there is no /pair route. When the link isn't claimed by the iOS app (Android / Google Lens, an iPhone without the app, or a desktop browser), the camera opens https://opencode.ai/pair#… and lands on the 404 page. Before, they at least saw the text. A small /pair page could explain how to get the app, or decode the fragment and show the /auth/connect/<code> links (it stays client-side, so the code still never reaches the server). That would avoid a dead end.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {content()} | ||
| </scrollbox> | ||
| } | ||
| {/* The QR code can be taller than the terminal, beside the links or under them, so the body scrolls. */} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Making the body always a scrollbox with maxHeight seems to make it fill that height. In a 120×45 terminal with only loopback addresses, the dialog now covers almost the whole screen, mostly empty and pinned to the top. On the base it was compact and centered (see the before/after screenshots). It may need the scrollbox to size to its content (e.g. no flex grow), or only switch to the scrollbox when the content is taller than the terminal.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
what happend to this pull request, it will be very helpfull |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is still an issue - the qr code opens the webapp, is unable to send intent to android app (launched today, I know!) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
tui: /pair QR code encodes the loopback 127.0.0.1 link, so other devices cannot connect
There was an error while loading. Please reload this page.