Tap a file below
Tech: Next.js 15 • React 19 • TypeScript • Wagmi v2 • Drizzle ORM
🔒 Server-Side Rate Limiting + Security Hardening (latest)
All three upload routes now enforce limits server-side:
• src/lib/upload-rate-limit.ts — shared checkServerUploadLimit() / recordServerUpload()
• Respects warm-up period, Upload Pass, Stack Pass, and team FID bypass
• /api/upload-check GET + POST both derive isMember from the registry (prevents spoofing)
• /api/register-cdn-link rate-limit key uses authenticated FID for Bearer requests
• getUserUploadStats accepts optional prefetchedMembers to eliminate redundant KV reads
• Client-side recordUpload() calls removed — server is sole write path; client calls refresh()
📱 Social Post Archiving — 10 Platforms (latest)
Archive posts from Farcaster, X/Twitter, Instagram, Bluesky, YouTube, TikTok, Reddit, Threads, LinkedIn, Mastodon:
• Paste post URL → fetch metadata → generate styled receipt via Satori → upload to Net Protocol
• hasAutoPopulatedRef prevents Farcaster cast data re-fetches from overwriting user edits
• Receipt title uses PLATFORM_INFO[platform]?.name (was hardcoded)
• fetchThreads / fetchLinkedIn now throw descriptive errors; params renamed _url
🖼 Image Editor — Full-Resolution Export (latest)
• Export scale multiplier: targetWidth / canvasSize.width with div-by-zero guard
• Eraser uses canvas background color (transparent for PNG, white for JPEG)
• Blob URLs tracked in ref and revoked on unmount (memory leak fix)
• All 4 export paths (download, save, share, receipt) use consistent resolution
🦊 Smart Wallet Capability Detection (latest)
• useWalletCapabilities — queries EIP-5792 wallet_getCapabilities
• Handles hex "0x2105", decimal-string "8453", and numeric 8453 chain ID key formats
• skipSendCalls = capabilitiesLoading || !hasAtomicBatch — defaults to skip until confirmed
• NET_LIBRARY_DATA_SUFFIX attached as dataSuffix on sendCallsAsync for ERC-8021 attribution
• isCoinbaseWalletUA() in src/lib/ua-utils.ts — centralises UA detection (was in 3 files)
• Cross-Origin-Opener-Policy: same-origin-allow-popups header added for popup wallet auth
🧑💻 UX Fixes (latest)
• Membership popup guarded by !isMembershipLoading — no flicker for existing members
• Server dismiss state re-fetched when wallet/FID identity changes (lastFetchedIdentity ref)
• API key CLI card in Achievements shows copy buttons for install + config set apiKey
• uploadsRemaining: 99999 for team members (was Infinity → serialised as null)
• Text editor uploads preserve HTML formatting when styled content detected (.html instead of .txt)
• Server-side preference persistence via /api/prefs (KV fallback for webviews)
🗂 Filesystem Stack Support — v1 API (v2.6.0)
PUT /api/v1/stacks/write now supports action: "add-fs-item" for filesystem stacks:
• Fields: contentKey, path (required, must start with /), fileName, fileSize, mimeType
• Stack must have isFileSystem: true — returns 400 otherwise
• Automatically updates fileCount and totalSize on the stack record
• GET /api/v1/stacks/{stackId} now returns filesystem metadata on both stack object and each item
• Filesystem stacks bypass discovery-index visibility filter (files don't have discovery entries)
🔑 PUT /api/v1/agents/me — Self-Service Profile Updates (v2.6.0)
Agents can now update their own profile without admin access:
• Fields: name, description, pfpUrl, webhookUrl, erc8004TokenId
• Setting erc8004TokenId triggers on-chain ERC-8004 re-verification and updates both agent record and member registry
🔶 ERC-8004 Token ID Fix — Embed Card (v2.6.0)
GET /api/v1/embeds/card/[address] now correctly returns erc8004TokenId:
• Token ID sourced from agent record (primary) with member registry as fallback
• Both erc8004Verified and erc8004TokenId always present for agent members
• RegisteredAgent type updated with erc8004TokenId, erc8004Verified, erc8004CheckedAt fields
🔶 ERC-8004 Verified Agent Integration (v2.5.0)
Agents on the ERC-8004 Base Identity Registry get verified badge:
• POST /api/v1/agents/verify-8004 - Re-verify ERC-8004 status
• PUT /api/v1/agents or PUT /api/v1/agents/me - Set erc8004TokenId to trigger verification
• Visual: Orange (#F97316) ring around PFP, BadgeCheck icon next to AGENT badge
• Verification: Calls ownerOf(tokenId) or balanceOf(address) on registry
• Caching: 1-hour cache, auto re-verify on embed widget load
• Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 on Base
🤖 Agent API v2.0 Embed Data Routes (v1.43.0)
New public JSON endpoints for embed widget data:
• /api/v1/embeds/card/[address] - Library card data (member info, stats, rank, PFP)
• /api/v1/embeds/grid/[gridId] - Grid metadata and cells with cover URLs
• /api/v1/embeds/user/[address] - User profile with paginated uploads
• CORS-enabled for cross-origin requests, no authentication required
• Agent detection: isAgent, agentId fields included when applicable
🔐 Agent API Enhancements (v1.43.0)
• /api/v1/agents/me - Full agent profile with widget embed URLs
• /api/v1/agents/membership - Library Card purchase (paid + admin grant)
• /api/v1/agents/tasks - Task queue for @mention workflows
• /api/v1/webhooks/farcaster - Neynar webhook receiver
• P1-P5 fixes: Race conditions, 20-item limits, bootstrap security, rate limiting
🎨 Emoji Font Support (v1.42.6)
Proper emoji rendering in Satori/ImageResponse:
• New shared utility: src/lib/emoji-font.ts
• On-demand fetch of Noto Color Emoji from CDN (~1.5MB)
• First request ~100-200ms, subsequent requests use cached font
• Fallback to Twemoji if primary fails
• Applied to social receipt rendering - emojis in usernames now display correctly
📜 Receipt Layout Improvements (v1.42.6)
Better social receipt readability:
• Trailing t.co URLs automatically stripped from tweet text
• Timestamp opacity increased (0.5 → 0.8)
• Footer URL opacity increased (0.35 → 0.7)
⚠️ XML Chunk Retrieval Fix (v1.42.5)
Fixed social receipt archives not displaying. For relay uploads:
• XML metadata embeds user's wallet in o attribute
• But relay's backend wallet actually writes the chunks
• /api/book-file now uses passed operatorAddress parameter
• Root cause: SDK generates XML before knowing backend wallet
⚠️ Satori Image Fix (v1.42.4)
Satori silently drops images without explicit dimensions. Fixed in receipt route:
• Container: height: 150, width: "100%" (not maxHeight)
• Image element: width={736} height={150} attributes required
• Result: Receipt size increased from ~27KB to ~196KB with embedded images
Media Archiving System
src/app/api/social/receipt/route.tsx
• fetchImageAsDataUrl(url): Downloads an image and converts to base64 data URL for embedding
• archiveMedia(content): Fetches avatar, images (up to 4), and video thumbnail in parallel with 8s timeout per fetch
• ArchivedMedia interface: { avatarDataUrl, imageDataUrls[], thumbnailDataUrl }
• arrayBufferToBase64(): Edge-compatible base64 encoding using btoa instead of Buffer
Twitter Image Extraction
src/app/api/social/fetch/route.ts
• extractTwitterImages(data): Comprehensive helper that checks all 5 possible image locations in Twitter syndication API responses (data.photos, mediaDetails, entities.media, extended_entities.media, card.binding_values)
Storage Architecture
Net Protocol storage types:
• regular: Files <20KB, single transaction
• chunked: Files 20-80KB, multi-chunk storage
• xml: Files >80KB, XML manifest + chunks
CDN URL Fix (v1.42.0)
Net Protocol's /chunked-storage/file/ endpoint returns 404.
Solution: Route through /api/book-file which uses /storage/raw/ endpoint.
Applied in: mini-app.tsx, book-card.tsx, book-detail.tsx
Dual Storage for Archives
Social receipts & grid archives use dual storage:
• KV (coverUrl): Fast thumbnail/card display via /api/upload-cover
• Onchain (contentKey): Permanent storage via Net Protocol
Flow: Generate → Upload to KV → Upload onchain → Register both URLs