Files
orca/src/shared/web-origin-security.test.ts
T
Neil 76fc1e5acd fix(web): pair and stay paired from plain-http LAN and Tailscale pages again (#29984)
Partially reverts #27540 and the plain-http part of #27552, which broke web
pairing on upgrade for 1.4.227 users who open Orca at a LAN or Tailscale address:

- The host no longer refuses a first pairing from a plain-http page on another
  machine (insecure_origin, ORCA_ALLOW_INSECURE_WEB_PAIRING).
- Such a page keeps its pairing code in local storage and signs in with it, as
  in 1.4.227, so reloads, new tabs and bookmarks stay paired; no notice.
- Session-only browser keys (pairing.device-key-ephemeral.v1, the idle sweep)
  stay for browsers without Ed25519.
- A web client whose credentials are refused shows the host's reason instead
  of an empty workspace and "Session restore failed".
2026-10-16 22:50:27 -07:00

18 lines
629 B
TypeScript

import { describe, expect, it } from 'vitest'
import { withWebClientUpgradeMarker } from './web-origin-security'
describe('web client upgrade marker', () => {
it('adds itself to the endpoint the web bundle dials', () => {
expect(withWebClientUpgradeMarker('ws://192.168.1.20:6768')).toBe(
'ws://192.168.1.20:6768/?orca-client=web'
)
expect(withWebClientUpgradeMarker('wss://desk.example.com/orca?x=1')).toBe(
'wss://desk.example.com/orca?x=1&orca-client=web'
)
})
it('leaves an unparseable endpoint alone', () => {
expect(withWebClientUpgradeMarker('not a url')).toBe('not a url')
})
})