From 89d2c259f60f6bcec2d960e6830940d333255e9c Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Thu, 25 Jun 2026 13:34:24 -0400 Subject: [PATCH] Fix event-management Refresh Kind to honor NIP-65 write-only relay designation and not read from write-only relays like sendit.nosflare.com --- www/event-management.html | 24 ++++++++++++++++++++++-- www/js/version.json | 6 +++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/www/event-management.html b/www/event-management.html index b14d999..30a0468 100644 --- a/www/event-management.html +++ b/www/event-management.html @@ -693,6 +693,7 @@ const eventRelayPresence = new Map(); // eventKey -> Map(relayUrl, boolean) const eventRelayPublishState = new Map(); // eventKey -> Map(relayUrl, 'idle'|'checking'|'publishing'|'failed') let subscribedRelayUrls = []; + let readableRelayUrls = []; // read/both relays only (excludes write-only) for Refresh Kind queries let refreshKindDebugInFlight = false; const autoRefreshedKinds = new Set(); const BRAILLE_SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; @@ -1027,12 +1028,26 @@ ? rows.filter((r) => r?.fromRelayList === true) : rows; + // subscribedRelayUrls includes all relays (read, write, both) so that + // write-only relays still appear as publish-target chips and are valid + // targets for the "publish to missing relays" flow. const urls = [...new Set(scopedRows .map((r) => String(r?.url || '').trim()) .filter(Boolean))]; subscribedRelayUrls = urls; + // readableRelayUrls excludes write-only relays (NIP-65 type === 'write') + // so the Refresh Kind query loop never tries to READ from a write-only + // relay. Falls back to the full list when type info is unavailable. + const hasTypeinfo = scopedRows.some((r) => r?.type); + readableRelayUrls = hasTypeinfo + ? [...new Set(scopedRows + .filter((r) => r?.type !== 'write') + .map((r) => String(r?.url || '').trim()) + .filter(Boolean))] + : [...urls]; + for (const relayMap of eventRelayPresence.values()) { for (const url of subscribedRelayUrls) { if (!relayMap.has(url)) relayMap.set(url, false); @@ -1815,8 +1830,13 @@ }); setSubscribedRelayUrlsFromRelayData(relayData); - const relayUrls = [...subscribedRelayUrls]; - console.log('[event-management] refresh:relayUrls scoped for query', relayUrls); + // Use readableRelayUrls (excludes write-only relays) so Refresh Kind + // never tries to READ from a write-only relay like sendit.nosflare.com. + const relayUrls = [...readableRelayUrls]; + console.log('[event-management] refresh:relayUrls scoped for query (read-only)', relayUrls, { + subscribedRelayUrls: subscribedRelayUrls, + readableRelayUrls: readableRelayUrls + }); if (!relayUrls.length) { divKindsStatus.textContent = `Kind ${targetKind}: no relays found in kind 10002 relay list`; diff --git a/www/js/version.json b/www/js/version.json index 3124516..514421d 100644 --- a/www/js/version.json +++ b/www/js/version.json @@ -1,5 +1,5 @@ { - "VERSION": "v0.7.19", - "VERSION_NUMBER": "0.7.19", - "BUILD_DATE": "2026-06-25T16:24:48.108Z" + "VERSION": "v0.7.20", + "VERSION_NUMBER": "0.7.20", + "BUILD_DATE": "2026-06-25T17:34:24.155Z" }