From 729690e58a2601ec9c96f5b4431944c1d8f999c7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 29 Jun 2026 07:22:30 -0700 Subject: Dev: proxy all regtest backends through the dev server for LAN/phone testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dev server already binds 0.0.0.0, but the app's regtest data source + SP indexer pointed at localhost, which on a phone means the phone's own localhost. Proxy them all through the dev server (same-origin), like /boltz already was: HTTP by prefix (/boltz, /esplora, /sp) and WebSocket by exact path (/electrum → Fulcrum, /sp/ws → SP indexer), with a Bun websocket relay. The regtest presets become relative paths, and a small absWsUrl() resolves '/path' WS URLs to ws(s):///path so they work from any device hitting the dev server. No per-device config, no CORS. Verified: /electrum relays Fulcrum 2.1.1, /esplora returns the tip height, and the desktop wallet still loads (balance 98,444) and connects through the proxy with no errors. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/api.js') diff --git a/src/api.js b/src/api.js index a12ddc6..186a0ca 100644 --- a/src/api.js +++ b/src/api.js @@ -76,8 +76,8 @@ const DATA_SOURCES_BY_NET = { { id: 'custom', label: 'Custom', type: 'auto', url: '' }, ], regtest: [ - { id: 'local', label: 'Local Fulcrum', type: 'electrum', url: 'ws://localhost:50003' }, - { id: 'localesplora', label: 'Local Esplora', type: 'esplora', base: 'http://localhost:3000', web: 'http://localhost:3000', kind: 'esplora' }, + { id: 'local', label: 'Local Fulcrum', type: 'electrum', url: '/electrum' }, + { id: 'localesplora', label: 'Local Esplora', type: 'esplora', base: '/esplora', web: 'http://localhost:3000', kind: 'esplora' }, { id: 'custom', label: 'Custom', type: 'auto', url: '' }, ], }; @@ -185,7 +185,7 @@ const SP_INDEXER_PRESETS_BY_NET = { mainnet: [{ id: 'coinos', label: 'coinos', url: 'https://sp.coinos.io' }, { id: 'custom', label: 'Custom', url: '' }], testnet: [{ id: 'custom', label: 'Custom', url: '' }], mutinynet: [{ id: 'custom', label: 'Custom', url: '' }], - regtest: [{ id: 'local', label: 'Local (localhost:8888)', url: 'http://localhost:8888' }, { id: 'custom', label: 'Custom', url: '' }], + regtest: [{ id: 'local', label: 'Local (proxied)', url: '/sp' }, { id: 'custom', label: 'Custom', url: '' }], }; const SP_INDEXER_DEFAULT = { mainnet: 'coinos', testnet: 'custom', mutinynet: 'custom', regtest: 'local' }; const SP_INDEXER_KEY = 'btc-wallet-sp-indexer'; -- cgit v1.2.3