Skip to content

feat(soldados): Nostr social (zaps, follows, ranking) + newsletter CRM proxy#35

Open
agustinkassis wants to merge 3 commits into
mainfrom
feat/soldados-nostr-social
Open

feat(soldados): Nostr social (zaps, follows, ranking) + newsletter CRM proxy#35
agustinkassis wants to merge 3 commits into
mainfrom
feat/soldados-nostr-social

Conversation

@agustinkassis

Copy link
Copy Markdown
Member

Summary

Adds a set of Nostr-native social features to the soldiers pages, plus a newsletter signup proxy. Built across this session.

Note: this branch also carries the earlier perf(badges): instant skeleton + ~4-5x faster relay fetch commit (537bab5), which had no PR yet.

Soldados — Nostr social

  • Zaps (NIP-57) — per-soldier zap button: pick amount + message, auto-pay via WebLN when present, otherwise show a BOLT11 QR + copy fallback. Falls back to a plain LNURL-pay (with comment) for any valid lightning address, not only ones that advertise NIP-57.
  • Live "Zaps recibidos" wall — real-time kind-9735 subscription showing sender (name/avatar) + message + amount.
  • Follow / unfollow (NIP-02) — button with status (Siguiendo / Te sigue / Se siguen), hover → red Dejar de seguir, and a styled confirm dialog with the user's avatar. Available on the profile, grid and table views via a batched follows provider (one relay round-trip for all rows).
  • Grid cards — social-style Nostr banner cover behind the avatar; incomplete profiles (missing name/avatar) sort to the end; softened cursor-tracking glare.
  • Admin "Recrear ranking" — recomputes the ranking from all sources (curated PROJECTS + reports.json + Nostr submissions), publishes it as a server-signed (LACRYPTA_NSEC) kind-30078 replaceable snapshot, server-caches it, and renders snapshot + newer Nostr submissions merged on top. Button is admin-gated (NEXT_PUBLIC_LACRYPTA_ADMIN_NPUB).

Newsletter

  • POST /api/events-subscribe — server-only proxy to La Crypta's CRM subscribe endpoint (EVENTS_SUBSCRIBE_URL / EVENTS_SUBSCRIBE_LISTS); reworked NewsletterCTA to use it.

Architecture notes

  • Official ranking event mirrors the existing reports/badges pattern: admin signs a kind-27235 authorization request → server validates + counter-signs with LACRYPTA_NSEC → publishes → revalidateTag. Read via lib/nostrSoldiersCache.ts ("use cache", static-null fallback to live compute).
  • No new required env vars (reuses LACRYPTA_NSEC, NEXT_PUBLIC_LACRYPTA_ADMIN_NPUB, REVALIDATE_SECRET).

Verification

  • pnpm exec tsc --noEmit clean.
  • /soldados renders 200 via the snapshot → live-fallback pipeline (no snapshot published yet).
  • /api/soldiers/ranking rejects unauthorized requests (400 missing request, 401 bad signature); admin/publisher pubkeys configured and distinct.
  • Zap modal discovers the lightning address and generates a real invoice; LNURL-pay fallback returns a valid BOLT11.
  • Follow confirm dialog + admin button render only in their intended states (verified in-browser with a simulated admin session).
  • A real ranking publish was not triggered (would write La Crypta's official event to public relays with the production key).

🤖 Generated with Claude Code

agustinkassis and others added 2 commits June 9, 2026 17:31
Add POST /api/events-subscribe as a server-only proxy to La Crypta's CRM
subscribe endpoint, configurable via EVENTS_SUBSCRIBE_URL / EVENTS_SUBSCRIBE_LISTS.
Rework NewsletterCTA to use it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nking

Add to the soldiers pages:
- Zap button (NIP-57) with amount/message, WebLN auto-pay, QR + LNURL-pay
  fallback to any valid lightning address (not only NIP-57-advertised ones).
- Live "Zaps recibidos" wall: real-time kind-9735 subscription, sender + text.
- Follow/unfollow (NIP-02) button with status (Siguiendo / Te sigue / Se siguen),
  hover "Dejar de seguir", and a styled confirm dialog with the user's avatar.
  Added to the profile, grid and table views via a batched follows provider.
- Grid cards: social-style Nostr banner cover behind the avatar; incomplete
  profiles (no name/avatar) sort to the end.
- Admin "Recrear ranking": recompute the ranking from all sources (curated +
  Nostr), publish it as a server-signed (LACRYPTA_NSEC) kind-30078 replaceable
  snapshot, server-cache it, and render snapshot + newer Nostr submissions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lacrypta-dev Ready Ready Preview, Comment Jun 9, 2026 8:50pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@agustinkassis, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 23 minutes and 43 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8c558cb-d5ac-4fa7-8bb2-e044c4f1fea7

📥 Commits

Reviewing files that changed from the base of the PR and between ce955fd and e4ef165.

📒 Files selected for processing (22)
  • .env.example
  • app/api/events-subscribe/route.ts
  • app/api/lnurl-invoice/route.ts
  • app/api/soldiers/ranking/route.ts
  • app/soldados/AdminRepublishRanking.tsx
  • app/soldados/ConfirmUnfollow.tsx
  • app/soldados/SoldiersClient.tsx
  • app/soldados/SoldiersFollows.tsx
  • app/soldados/SoldiersGrid.tsx
  • app/soldados/SoldiersTable.tsx
  • app/soldados/[slug]/SoldierFollowButton.tsx
  • app/soldados/[slug]/SoldierZapButton.tsx
  • app/soldados/[slug]/SoldierZapWall.tsx
  • app/soldados/[slug]/page.tsx
  • components/sections/NewsletterCTA.tsx
  • data/hackathons/projects-commerce.json
  • lib/follows.ts
  • lib/nostrCacheTags.ts
  • lib/nostrSoldiersCache.ts
  • lib/soldiers.ts
  • lib/soldiersRanking.ts
  • lib/zap.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/soldados-nostr-social

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The ranking sourced curated data only from lib/projects.ts PROJECTS, a
hand-maintained subset that had drifted out of sync with the authoritative
per-hackathon files (data/hackathons/projects-<id>.json). Whole hackathons
(all of commerce) and several identity projects — plus their jury positions —
were therefore uncounted.

- Ingest allProjects() (foundations/identity/commerce, with reports.position)
  as a curated source in computeRanking, matching team members by the same
  multi-identity heuristic as the Nostr pass; the existing dedupe collapses
  overlaps with the PROJECTS pass.
- Populate wapubot's empty team in projects-commerce.json.

Now e.g. Fred is credited Cursats (commerce, 1st → +10): 2 → 12 pts, and
landaverdend's 3rd hackathon (wapubot, commerce) shows.

Closes #34
Closes #33

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant