fix: support dev server previews over relay

This commit is contained in:
Bohdan Triapitsyn
2026-09-03 11:49:34 +03:00
parent da6ab52a65
commit a87f068256
16 changed files with 504 additions and 36 deletions
@@ -310,6 +310,7 @@ const isUrlAuthWebSocketPath = (pathname) => {
|| pathname === '/api/openchamber/realtime-proxy/ws'
|| pathname === '/api/terminal/ws'
|| pathname === '/api/dictation/ws'
|| pathname === '/api/dev-tunnel'
|| pathname.startsWith('/api/preview/proxy/');
};
@@ -221,6 +221,22 @@ describe('ui auth client credential seam', () => {
};
expect(await auth.ensureSessionToken(dictationWsReq, null)).toBe('client:device-1');
const devTunnelWsReq = {
method: 'GET',
path: '/api/dev-tunnel',
url: `/api/dev-tunnel?port=4322&oc_url_token=${encodeURIComponent(urlToken)}`,
headers: { upgrade: 'websocket' },
};
expect(await auth.ensureSessionToken(devTunnelWsReq, null)).toBe('client:device-1');
const devTunnelSubpathWsReq = {
method: 'GET',
path: '/api/dev-tunnel/private',
url: `/api/dev-tunnel/private?port=4322&oc_url_token=${encodeURIComponent(urlToken)}`,
headers: { upgrade: 'websocket' },
};
expect(await auth.ensureSessionToken(devTunnelSubpathWsReq, null)).toBe(null);
const dictationHttpReq = {
method: 'GET',
path: '/api/dictation/ws',