Problem
The web app auto-detects a local relay in init.js by checking location.hostname:
if (!window.__WILLOW_RELAY_URL && (h === '127.0.0.1' || h === 'localhost')) {
window.__WILLOW_RELAY_URL = 'http://' + h + ':3340';
}
This hardcodes port 3340 and only works for localhost. It also requires a separate init.js file copied by trunk because inline scripts in index.html get stripped during trunk processing.
Better Approach
Options:
- Trunk environment variables — use
data-trunk attributes or build-time env vars to inject the relay URL at build time
- Runtime config endpoint — serve a
/config.json from trunk or the relay that the app fetches on startup
- Query parameter — support
?relay=http://... for ad-hoc testing
The DEFAULT_RELAY_URL constant in app.rs should also be updated when the production relay infrastructure changes — currently it points to https://willow.intendednull.com:9443 which uses the old multiaddr format constant.
Files
crates/web/init.js — hardcoded port 3340
crates/web/src/app.rs — resolve_relay_url() reads window.__WILLOW_RELAY_URL
Problem
The web app auto-detects a local relay in
init.jsby checkinglocation.hostname:This hardcodes port 3340 and only works for localhost. It also requires a separate
init.jsfile copied by trunk because inline scripts inindex.htmlget stripped during trunk processing.Better Approach
Options:
data-trunkattributes or build-time env vars to inject the relay URL at build time/config.jsonfrom trunk or the relay that the app fetches on startup?relay=http://...for ad-hoc testingThe
DEFAULT_RELAY_URLconstant inapp.rsshould also be updated when the production relay infrastructure changes — currently it points tohttps://willow.intendednull.com:9443which uses the old multiaddr format constant.Files
crates/web/init.js— hardcoded port 3340crates/web/src/app.rs—resolve_relay_url()readswindow.__WILLOW_RELAY_URL