mirror of
https://github.com/PR0M3TH3AN/Artstr-Studio.git
synced 2026-10-28 01:00:41 +00:00
Phase 1 — Sign zap requests: - When the LNURL endpoint advertises allowsNostr + nostrPubkey and the tipper has NIP-07, sign a kind-9734 zap request and pass it as the nostr= param to the pay callback. Tags include e (event id), a (naddr coords) and p (recipient) for feed-card / preview tips, or just p for profile tips. - Silent fallback to plain LNURL-pay for non-zap endpoints or signed-out users. Tips never silently fail. - Tiny "⚡ Tracked zap" badge in the invoice view when the zap path engaged, so QR / copy users know their tip will count. Phase 2 — Aggregate and display: - Parse kind-9735 receipts via the embedded description tag (NIP-57 amount) or a bolt11 amount fallback (with multiplier table). - _zapCache aggregates by event id and by author pubkey; receipts are deduped by event id. - Feed enrichment phase batch-queries receipts by #e for visible designs; profile-page opens query by #p for the author and by #e for each design in the grid. - Feed cards display a "⚡ <total>" badge in the actions row. - Design preview meta line gets the same badge. - Profile page header shows "⚡ X sats received" under the npub. Sort and visibility: - New "⚡ Zapped" tab in both the Community modal and the welcome modal. Sort is pure zap-total with date as the tiebreaker. - Existing Popular sort now leads with zap totals, falling back to reactions, trust, and date. - isPreviewBroken now flags designs pre-emptively when the preview URL is missing (for modes that require artwork) or uses a non-http scheme, so broken designs sink to the bottom on first paint instead of waiting for an actual image-load failure. - Broken-image set persists to localStorage so detected breakage survives reloads. Payment detection: - After a tracked invoice is issued, a background poller queries kind-9735 events with #p=recipient + since=now. When a receipt arrives whose embedded zap request matches the tipper's pubkey, the event id, and the amount (within 10% tolerance), the modal shows "✓ Payment received! Closing…" and auto-closes 1.2s later. Polling stops after 5 minutes (invoice expiry), on close, or on "New amount". - WebLN auto-pay button appears in the invoice view when window.webln is available; one click pays via the extension and closes the modal on success. Rejections are handled quietly so the QR / copy paths remain available. Co-Authored-By: Claude Opus 4.7 <[email protected]>