Fix zap hang from dead outbox relay, add note preview to zap history

Override NDK default outbox relays (purplepag.es DNS failure was stalling
getZapInfo), add 45s zap timeout, disable outbox on NWC instance, fix
follower notification dedup in poller. Zap history rows now show a
clickable preview of the original zapped note.
This commit is contained in:
Jure
2026-03-30 20:23:32 +02:00
parent 1d86023779
commit 383634fb56
5 changed files with 80 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ export function isValidNwcUri(uri: string): boolean {
export async function payInvoiceViaNWC(nwcUri: string, bolt11: string): Promise<string> {
const { walletPubkey, relayUrl, secret } = parseNwcUri(nwcUri);
const ndk = new NDK({ explicitRelayUrls: [relayUrl] });
const ndk = new NDK({ explicitRelayUrls: [relayUrl], enableOutboxModel: false });
const signer = new NDKPrivateKeySigner(secret);
ndk.signer = signer;
await ndk.connect();

View File

@@ -44,6 +44,13 @@ export const FALLBACK_RELAYS = [
"wss://relay.snort.social",
];
// Override NDK's default outbox relays (purplepag.es can have DNS issues)
export const OUTBOX_RELAYS = [
"wss://relay.damus.io/",
"wss://nos.lol/",
"wss://relay.nostr.band/",
];
export function getStoredRelayUrls(): string[] {
try {
const stored = localStorage.getItem(RELAY_STORAGE_KEY);
@@ -63,6 +70,7 @@ export function getNDK(): NDK {
if (!ndk) {
ndk = new NDK({
explicitRelayUrls: getStoredRelayUrls(),
outboxRelayUrls: OUTBOX_RELAYS,
});
ndkCreatedAt = Date.now();
}
@@ -92,6 +100,7 @@ export async function resetNDK(): Promise<void> {
// Create fresh instance
ndk = new NDK({
explicitRelayUrls: getStoredRelayUrls(),
outboxRelayUrls: OUTBOX_RELAYS,
});
ndkCreatedAt = Date.now();

View File

@@ -89,6 +89,10 @@ async function pollOnce(pubkey: string) {
const newFollowers = followers.filter((e) => e.pubkey !== pubkey && !existingFollowerPubkeys.has(e.pubkey));
if (newFollowers.length > 0) {
dbSaveNotifications(newFollowers.map((e) => JSON.stringify(e.rawEvent())), pubkey, "follower");
// Add to in-memory store so next poll cycle's pubkey dedup catches them
const store = useNotificationsStore.getState();
const updated = [...store.notifications, ...newFollowers];
useNotificationsStore.setState({ notifications: updated });
for (const e of newFollowers) {
const name = await getProfileName(e.pubkey);
notifyFollower(name).catch(() => {});