Skip to content

feat(app): pair servers from QR codes - #46098

Open
Hona wants to merge 2 commits into
anomalyco:v2from
Hona:qr-pairing
Open

feat(app): pair servers from QR codes#46098
Hona wants to merge 2 commits into
anomalyco:v2from
Hona:qr-pairing

Conversation

@Hona

@Hona Hona commented Aug 29, 2026

Copy link
Copy Markdown
Member

Issue for this PR

Requested QR pairing for the V2 web and desktop clients. No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds QR pairing to Add Server using the existing opencode2 pair payload. Browser users can scan with a camera; web and desktop users can import a QR image. The dialog explains which command to run.

  • Validates and fills the address and credentials, then uses the existing authenticated connection check when the user selects Add server. Scanning does not send credentials to the advertised addresses.
  • Uses native URL parsing and ipaddr.js range/CIDR APIs to prefer public addresses, then tailnet, LAN, link-local, and loopback. HTTPS breaks ties. Alternatives remain selectable; this is address preference, not a reachability probe.
  • Keeps camera resources scoped to the scanner and the dialog usable on short screens. No CLI package changes.

The QR format is unchanged and contains the reusable service password. Remote connections still require a reachable listener; browsers may block HTTP servers from an HTTPS page. This PR does not add TLS or change server binding.

How did you verify your code works?

  • App unit suite: 609 passed. Browser-condition suite: 69 passed.
  • App, desktop, and CLI bun typecheck; production web build.
  • Three Playwright pairing tests against the production build: real QR-image decoding/authentication, invalid codes, and camera cleanup with a canvas-backed MediaStream at 390x600.
  • Desktop/mobile, English LTR/RTL, and Arabic RTL visual checks. Scanner decoding is lazy-loaded.
  • Prettier and git diff --check.

Full typecheck:e2e is blocked by the existing HTMLElement | SVGElement.dir error at e2e/regression/new-session-workspace-pending.spec.ts:38, also present in the base commit. Physical camera hardware was not used.

Screenshots / recordings

Before: Add Server before QR pairing

After: Add Server with QR pairing

Mobile: Imported pairing details on mobile

RTL: Arabic layout with English fallback and LTR addresses

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Hona
Hona requested a review from Brendonovich as a code owner August 29, 2026 05:47
Copilot AI lite review requested due to automatic review settings August 29, 2026 05:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants