From cb5826cec34bd6933f1d8d3f1d76629b15ba44a1 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 Nov 2026 21:42:23 -0700 Subject: Signer sign-in links name relays that are up. "I tried pasting from Coinos into Amber, and it just left Coinos in the spinning, waiting for signer state" (Adam, 2026-11-19, signing a PAFF account in through Amber). The nostrconnect:// link named relay.coinos.io and nos.lol, and nos.lol was refusing connections from the phone and the laptop. Amber publishes its approval to the link's relays, and the page waits on those same relays, so a dead one can leave the sign-in spinning until it times out. The link now names three relays: relay.coinos.io, then relay.primal.net (up, and it keeps NIP-46 traffic), then nos.lol or offchain.pub. Any relay this device has recently marked dead is left out and the next one takes its place; relay.coinos.io is always kept. New connect-relays-test passes, as do signer-resume, amber-dm-upgrade and features-smoke. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6TV6sjEZSpqqBen9T5 --- tools/connect-relays-test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/connect-relays-test.js (limited to 'tools') diff --git a/tools/connect-relays-test.js b/tools/connect-relays-test.js new file mode 100644 index 0000000..f54407d --- /dev/null +++ b/tools/connect-relays-test.js @@ -0,0 +1,18 @@ +// The relays a nostrconnect:// link names: relay.coinos.io first, then the +// next live ones, three in all, leaving out any this device found dead. +// Run: bun tools/connect-relays-test.js +import { connectRelays } from '../src/nostr-login.js'; +import { markRelaySick } from '../src/nostr.js'; +let ok = true; +const check = (n, c, d = '') => { console.log(` ${c ? '✓' : '✗'} ${n}${d ? ' — ' + d : ''}`); if (!c) ok = false; }; +const fresh = connectRelays(); +check('three relays, ours first, primal second', fresh.length === 3 && fresh[0] === 'wss://relay.coinos.io' && fresh[1] === 'wss://relay.primal.net', fresh.join(' ')); +check('nos.lol is no longer second', fresh[1] !== 'wss://nos.lol'); +markRelaySick('wss://nos.lol', 'test'); +const after = connectRelays(); +check('a relay found dead is left out, the next one takes its place', !after.includes('wss://nos.lol') && after.includes('wss://offchain.pub') && after.length === 3, after.join(' ')); +markRelaySick('wss://relay.primal.net', 'test'); markRelaySick('wss://offchain.pub', 'test'); +const one = connectRelays(); +check('relay.coinos.io stays whatever else is down', one[0] === 'wss://relay.coinos.io', one.join(' ')); +console.log(ok ? '\n✅ connect links name live relays' : '\n❌ failed'); +process.exit(ok ? 0 : 1); -- cgit v1.2.3