aboutsummaryrefslogtreecommitdiffstats
path: root/src/dm.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-14 18:05:05 -0700
committerAdam Soltys <[email protected]>2026-09-14 18:05:05 -0700
commit4c4917b3697050e0a83d6977d76a76e6f436d5b7 (patch)
tree80416057cc664ccd1b87cf93ffb39064539af41b /src/dm.js
parentcb4e155ae6fb72282d5f186389d2ecca6db6a0f0 (diff)
downloadcoinosv3-4c4917b3697050e0a83d6977d76a76e6f436d5b7.tar.gz
coinosv3-4c4917b3697050e0a83d6977d76a76e6f436d5b7.zip
Messages sent while the app was away arrive when it comes back.
Two ways a DM or a room message went missing. A phone freezing the tab errors the relay sockets, and an errored socket is one the pool gives up on — so every wrap subscription died silently and nothing sent after the freeze ever arrived, until a reload. Coming back from the background (or back online) now rebuilds the DM and room subscriptions; their windows overlap what is held and seen wraps are dropped before any decryption. And a remote signer that never answered was read as "this wrap isn't ours": three such silences and the wrap was remembered as seen and lost on that device for good. Silence now means "try later" — uncounted — and the drain stops at the first one rather than burning tries on the rest. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYJfZ4A1TDCEY4Foq3CApR
Diffstat (limited to 'src/dm.js')
-rw-r--r--src/dm.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dm.js b/src/dm.js
index 000e63c..46789e8 100644
--- a/src/dm.js
+++ b/src/dm.js
@@ -112,7 +112,12 @@ export async function unwrapDM(wrap, skOrSigner) {
const to = rumor.tags?.find((t) => t[0] === 'p')?.[1];
const mine = rumor.pubkey === signer.pubkey;
return { rumor, author: seal.pubkey, peer: mine ? to : rumor.pubkey };
- } catch {
+ } catch (e) {
+ // A remote signer that never answered is not "not ours": the caller must
+ // try again later, not give the wrap up. Every other failure means the
+ // wrap was sealed to someone else.
+ if (SIGNER_SILENT.test(e?.message || '')) throw e;
return null;
}
}
+export const SIGNER_SILENT = /did not answer|timed? ?out|connect|closed|socket|relay|network/i;