Commit Graph

154 Commits

Author SHA1 Message Date
Jeff Emmett eb470dff18 fix(auth): use client-side access gate for private spaces
Server-side HTML gates can't work because auth tokens are in
localStorage, not cookies. Replaced with:
- Client-side gate checks session, then verifies membership via
  new /api/space-access/:slug endpoint
- Shows "Sign In" for unauthenticated users
- Shows "no access + return to your space" for non-members
- Server-side gates remain for API/JSON requests and WebSocket

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:03:28 -07:00
Jeff Emmett 7d4e6122f1 feat(auth): enforce space access control for private spaces
Non-members of private spaces are now blocked at three layers:
- WebSocket upgrade rejects with 403
- Module middleware shows access denied page (browser) or JSON 403 (API)
- Space root dashboard shows access denied page
Friendly "Private Space" page with link back to user's own space.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:49:50 -07:00
Jeff Emmett 0fbf12e5f8 fix(routing): serve rspace.online/{moduleId} as app in shell instead of landing page
rspace.online/rcal was redirecting to rcal.online (standalone domain) via
the landing page proxy. Now rewrites to /demo/{moduleId} so it loads the
actual app within the rSpace shell with app/space switchers, matching the
behavior of {space}.rspace.online/{moduleId}.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:24:39 -07:00
Jeff Emmett 6f066f649a fix(server): block disabled modules on subdomain routes
Ensure disabled modules redirect to space root on subdomain routing,
and pre-load community doc before checking enabled modules list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 23:17:11 -07:00
Jeff Emmett 6491681e3e fix(auth): force platform authenticator + redirect disabled modules
Force authenticatorAttachment: 'platform' across all WebAuthn registration
flows to prevent USB security key prompts. Redirect browser navigations to
space root when accessing disabled modules instead of returning JSON error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 22:31:13 -07:00
Jeff Emmett dbe60f2711 fix(onboarding): remove moduleHasData gate so live spaces show module UI
Live spaces with no CRDT data were showing a generic onboarding page
instead of the module's actual UI. Demo always bypassed this check,
causing visual parity issues between demo.rspace.online and live spaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 18:22:11 -07:00
Jeff Emmett acafe15c4b feat(spaces): resolve member DIDs to usernames in space settings
Add POST /api/users/resolve-dids batch endpoint in EncryptID, proxy
/api/users/* through rspace server, and batch-resolve missing displayNames
in the space settings panel so owners and members show usernames not DIDs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 16:39:48 -07:00
Jeff Emmett b7aadf66cd feat(sync): proxy /api/user/* to EncryptID for cross-session tab state
Adds catch-all proxy route so client tab sync requests (saveTabs/syncTabsFromServer)
reach the EncryptID container. Also fixes rstack-mi panel positioning and
Shadow DOM click-outside handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 16:22:37 -07:00
Jeff Emmett ca9e91651c fix(spaces): default visibility to private (sovereign by default)
Spaces with missing/undefined visibility were falling through to "public"
in 7 places: normalizeVisibility fallback, migrateVisibility early return,
renderShell default, getSpaceConfig, space list APIs, and the HTML
injection middleware. All now default to "private". The migrateVisibility
function now writes "private" to docs with missing visibility on load.

Also fixed jeff and hash spaces on production (were undefined → private).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 15:24:00 -07:00
Jeff Emmett f8ab716722 feat(x402): bridge on-chain USDC payments with CRDT token ledger
Connects x402 (on-chain USDC via Base) and CRDT token system (Automerge cUSDC)
in both directions: on-chain payments auto-mint cUSDC to payer's DID, and users
can pay with cUSDC balance via new "crdt" payment scheme. 402 responses now
return both exact and crdt payment options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:23:24 -07:00
Jeff Emmett d31e8fdca4 feat(spaces): blank canvas init + team inbox provisioning
New spaces start with an empty canvas instead of 25+ template shapes.
Each space gets a {slug}@rspace.online team inbox (multi-sig ready)
via the rinbox onSpaceCreate hook. Fix EncryptID auto-provision passing
raw string instead of SpaceLifecycleContext to module hooks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 13:59:35 -07:00
Jeff Emmett 4793f9c117 feat(crowdsurf): restore module and add Elo pairwise ranking layer
Restore CrowdSurf as standalone module with full integration (server,
app-switcher, shell favicon, rchoices tab, vite build). Add sortition-
based pairwise Elo ranking: users compare two activities head-to-head,
updating Elo ratings. Includes API endpoints (/api/crowdsurf/pair,
/api/crowdsurf/compare), Rank tab with leaderboard, and Elo badges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 23:51:24 -07:00
Jeff Emmett d99b85046c feat(rswag): full feature parity — POD clients, dithering, AI gen, fulfillment
8-phase implementation bringing rSwag module to parity with standalone rswag.online:
- Printful v2 + Prodigi v4 API clients with sandbox mode
- 11 dithering algorithms + screen-print color separations
- Gemini AI design generation + user artwork upload
- ~15 new API routes (designs, mockups, storefront, fulfillment, admin)
- 4-tab frontend UI (Browse, Create, HitherDither, Orders)
- Interactive revenue Sankey diagram on landing page
- Fulfillment bridge routing orders to nearest POD provider

Also includes: rChats module scaffold, rVote enhancements, crowdsurf removal,
rchoices cleanup, rwallet tweaks, app-switcher updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 23:21:53 -07:00
Jeff Emmett d4972453a3 feat(onboarding): add module-specific connect/import/create CTAs
Declarative onboardingActions on RSpaceModule lets each rApp define its
own onboarding cards (import, upload, link, create). renderOnboarding()
renders them as a responsive card grid with upload handling. Adds ICS
import endpoint to rCal (POST /api/import-ics). 15 modules wired up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 14:17:19 -07:00
Jeff Emmett 73ad020812 fix(spaces): fix space creation routing and use /rspace URLs
Space creation was broken because the canvas module has id "rspace" but
all navigation URLs used "/canvas". On production subdomain routing this
resulted in 404s after creating a space.

- Switch create-space form from deprecated /api/communities to /api/spaces
- Replace all /canvas navigation URLs with /rspace to match module ID
- Fix DID matching in space listing to check both sub and did:key formats
- Add proper client DID support in EncryptID registration flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 11:07:01 -07:00
Jeff Emmett a736321189 feat(rnotes): add real-time Yjs collaboration, comments, and suggestions
Replace whole-content Automerge sync with character-level Yjs CRDT for
NOTE-type notes. Adds cursor presence, inline comments with threaded
replies, and track-changes suggesting mode.

- Custom Yjs WebSocket provider bridging over existing rSpace WS
- Server-side yjs-sync/yjs-awareness message relay (pure broadcast)
- y-indexeddb for offline persistence, periodic plaintext sync to Automerge
- Comment mark + panel with resolve/reply/delete
- Suggestion insert/delete marks with accept/reject support
- Schema v3→v4 (collabEnabled, comments fields)
- Collab toolbar: comment button, suggesting toggle, peer indicators

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 10:36:09 -07:00
Jeff Emmett 1f97a2ceba fix(smtp): use noreply@rmail.online as sender across all modules
Mailcow rejects noreply@rspace.online because the authenticated user
is noreply@rmail.online. Updated all SMTP_FROM and SMTP_USER defaults
to use rmail.online consistently: spaces invites, rSplat notifications,
EncryptID auth emails, and rCart payment receipts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 21:00:41 -07:00
Jeff Emmett e5814b12c6 fix(rsplat): use fal.ai response_url for result fetch, add poll logging
The result fetch was constructing its own URL instead of using the
response_url returned by fal.ai's status poll. This caused 422 errors.
Now captures response_url from poll and uses it for result retrieval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 20:51:05 -07:00
Jeff Emmett d999c98b98 fix(rsplat): resize images with sharp before fal.ai submission
Phone photos (3-4MB, 4000px+) were failing with "Invalid image" on
fal.ai Hunyuan3D. Now resizes to max 1024px JPEG with sharp before
submitting, and uses PUBLIC_ORIGIN HTTPS URL instead of data URI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 20:36:59 -07:00
Jeff Emmett ad22ed7482 fix(rsplat): send image as data URI to fal.ai, fix http:// URL issue
The publicUrl helper was generating http:// URLs (x-forwarded-proto from
Traefik), causing fal.ai to fail with "Invalid image" 422 errors. Now
reads the staged image from disk and sends as base64 data URI for
reliable delivery. Also bumps poll timeout from 5 to 8 minutes and
surfaces actual fal.ai error messages to the client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 20:26:36 -07:00
Jeff Emmett d5d3f09b28 feat(rvnb): add (you)rVnB — community RV & camper rental module
Peer-to-peer RV/camper rentals within community trust networks.
Forked from rBnb with vehicle-specific concepts: specs, mileage
policies, pickup/dropoff locations, and dry humor throughout.

4 seed vehicles, full CRUD API, Leaflet map with pickup/dropoff
markers, rental request flow, endorsement tags including
"suspiciously_clean" and "smells_like_adventure".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 19:26:59 -07:00
Jeff Emmett 14c183b992 fix(rsplat): use request Host header for staged image URLs
fal.ai needs to download the staged image. Using hardcoded PUBLIC_ORIGIN
(rspace.online) fails because Cloudflare redirects /data/ paths and the
subdomain (jeff.rspace.online) isn't matched. Now derives the public URL
from the request's Host header. Added logging for staged image URLs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 17:02:10 -07:00
Jeff Emmett 3c1802ab07 fix(rsplat): serve staged images via /api/ path to avoid Cloudflare redirect
Cloudflare/Traefik 301-redirects /data/ paths to data.rspace.online, which
fal.ai can't follow. Staged images now served at /api/files/generated/ which
passes through correctly. Added route alias for backwards compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 16:59:25 -07:00
Jeff Emmett 6b3fbd36b0 feat(rsplat): gallery thumbnails via model-viewer + fix 3D gen error handling
GLB models now render inline 3D previews using Google's <model-viewer> web
component with auto-rotate. AI-generated models show source image thumbnails.
Fixed fal.ai result fetch with retry logic and detailed logging for diagnosis.
Save flow now uses save-generated API with thumbnail_url passthrough.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 16:22:31 -07:00
Jeff Emmett 7da90088c4 fix(rsplat): fix GLB viewer not rendering on mobile
Defer initThreeViewer to next animation frame so the DOM has laid out
before reading container dimensions. Fall back to viewport size instead
of hardcoded 800x600 when container reports zero dimensions. Add proper
MIME types for GLB/GLTF file serving.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:15:24 +00:00
Jeff Emmett 2ea6fee951 feat: add CrowdSurf module — swipe-based community activity coordination
Implements the Crowdsurfing protocol (gospelofchange/Crowdsurfing) as an
rSpace module with full local-first Automerge CRDT sync. Users propose
activities with commitment thresholds, others swipe to join and declare
contributions, and activities trigger when enough people commit.

Module includes schemas, local-first client, swipe UI dashboard with
pointer gesture detection, landing page, seed template data, and
Vite build integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:12:19 +00:00
Jeff Emmett 51da13ac46 feat(rbnb): add community hospitality module — trust-based space sharing
New rSpace module for couch surfing and space sharing within community networks.
Gift economy as first-class option, rNetwork trust graph for auto-accept,
messages embedded in CRDTs, endorsements feed back into trust graph.

- schemas.ts: Listing, StayRequest, Endorsement, AvailabilityWindow, SpaceConfig types
- mod.ts: 18 API endpoints (listings, availability, stays, endorsements, search, stats, config)
- landing.ts: Marketing page with warm amber/red/pink palette
- local-first-client.ts: Automerge sync wrapper (BnbLocalFirstClient)
- components: folk-bnb-view (grid+map), folk-listing (card shape), folk-stay-request (detail)
- bnb.css: Economy badges, status indicators, message thread styles
- Registered in server/index.ts, added r🏠 badge to app switcher under "Sharing"
- 6 demo listings (gift couch, exchange farm, suggested tent, sliding loft, gift hub, fixed cabin)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 16:01:50 -07:00
Jeff Emmett f1de3b654e fix(rsplat): handle formData parse errors in image-stage endpoint
Wrap formData() in try/catch with logging to diagnose Content-Type
issues through Cloudflare tunnel. Also fix client-side error handling
to clear progress timer and show actual error message on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:53:59 -07:00
Jeff Emmett fd63c2bc6f feat(rsplat): default to image upload + switch job queue to Hunyuan3D
- Default upload tab is now "Generate from Image"
- Entire dotted drop area is clickable to open file browser
- Update process3DGenJob to use Hunyuan3D v2.1 via fal.ai queue API
  (was still using old Trellis endpoint)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:48:43 -07:00
Jeff Emmett 84c3c318d8 feat: async 3D gen, calendar reminder widget, cross-module drag, subdomain URL fixes
- Make /api/3d-gen async with job queue + email notification on completion
- Add reminder mini-calendar widget to canvas (top-right on shape select)
- Make items draggable across 6 modules (rNotes, rTasks, rFiles, rSplat, rPhotos, rBooks)
- Upgrade rCal drop handler with time-picker popover instead of confirm()
- Show reminder indicators (dots + badges) on calendar days
- Fix subdomain routing: remove space slug from server-rendered sub-nav,
  tab bar, and module links in production (/{moduleId} not /{space}/{moduleId})
- Add buildSpaceUrl() helper for correct external URL generation
- Fix rcart payment URLs for subdomain routing
- Fix rSchedule email links to use subdomain format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:18:51 +00:00
Jeff Emmett 55b47901ab fix(rsplat): use fal.ai queue API to avoid timeout on Hunyuan3D
Synchronous fal.run endpoint times out for textured mesh generation.
Switch to queue.fal.run submit/poll/result pattern with 5-minute
deadline. Update client progress phases for longer generation time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:46:30 -07:00
Jeff Emmett 26c1e72bb1 feat(rsplat): switch to Hunyuan3D v2.1 for reliable image-to-3D
SAM 3D was designed for object segmentation, not full-scene
reconstruction — failed on arbitrary images. Hunyuan3D v2.1 produces
high-quality textured GLB meshes from any single image reliably.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:37:57 -07:00
Jeff Emmett 2813886738 fix(rsplat): use box_prompts to bypass SAM 3D grounding detection
Text prompts require Grounding DINO to detect specific objects, which
fails on arbitrary images. Using a full-image bounding box bypasses
text detection entirely and reconstructs the whole scene as a Gaussian
splat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:30:32 -07:00
Jeff Emmett 67eef28f68 debug(rsplat): add logging for 3d-gen request/response
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:15:45 -07:00
Jeff Emmett 66d347091d fix(rsplat): bump detection_threshold to 0.1 (API minimum)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:12:57 -07:00
Jeff Emmett 96fd5ef756 fix(rsplat): use concrete object classes for SAM 3D grounding
SAM 3D uses Grounding DINO which needs real noun classes, not abstract
terms. Use broad multi-class prompt with very low threshold (0.05) to
detect objects in any image type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:10:32 -07:00
Jeff Emmett 31025c24d7 fix(rsplat): add prompt and detection_threshold for SAM 3D
SAM 3D requires a segmentation prompt — default "car" fails on
non-car images. Use "everything" with low threshold (0.2) to capture
full scenes including people and backgrounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:07:19 -07:00
Jeff Emmett 0f1090db44 feat(rsplat): switch AI generation from Trellis 2 to SAM 3D
SAM 3D outputs native Gaussian splat .ply files (rendered via existing
initSplatViewer) instead of GLB meshes, with full-scene support including
people and backgrounds. Faster generation (5-30s vs 45-75s), $0.02/gen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:03:39 -07:00
Jeff Emmett aabc2de7d8 Fix /rtasks/check/:token 404 — bypass module rewriting for checklist routes
The bare-domain and subdomain routing intercepted /rtasks/check/* paths,
rewriting them to /demo/rtasks/check/* which didn't match any route.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:32:00 -07:00
Jeff Emmett 21b1e8fa0a feat(rsplat): image staging endpoint, viewer improvements, SW updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:24:40 -07:00
Jeff Emmett d0fbbd2ee5 fix(rtasks): mount checklist routes at top level to bypass space auth
The checklist check/send endpoints don't need space context — the HMAC
token and API key provide their own auth. Routes are now:
  GET  /rtasks/check/:token
  POST /api/rtasks/send

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:09:37 -07:00
Jeff Emmett d008b78727 fix(rsplat): save-to-gallery, remove broken media upload, fix leaks
- Add POST /api/splats/save-generated so AI-generated 3D models persist
- Add "Save to Gallery" button in viewer after AI generation
- Remove non-functional "Upload Photos/Video" tab (no processing worker)
- Add 120s server-side timeout on fal.ai Trellis 2 fetch
- Fix GLB viewer memory leak (animation loop + resize listener on disconnect)
- Show elapsed time + phase messages during generation progress
- Bump CSS v3, JS v4 cache versions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:56:33 -07:00
Jeff Emmett 88b20f13f5 feat(rsplat): upgrade to Trellis 2 for higher quality 3D generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 21:07:45 -07:00
Jeff Emmett 51fcf93df7 Merge branch 'dev' 2026-03-15 17:04:15 -07:00
Jeff Emmett c5f757d050 fix(rsplat): resize images client-side before 3D generation, pass through fal.ai errors
Mobile photos (12MP+) were causing generation failures due to large base64 payloads.
Now resizes to max 1024px before sending. Server now returns actual fal.ai error
messages instead of generic "3D generation failed".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 16:56:35 -07:00
Jeff Emmett 6e5ddaface Merge branch 'dev' 2026-03-12 20:25:40 -07:00
Jeff Emmett aa6f04e45e fix: resolve all 127 TypeScript errors with Hono type augmentation
Add types/hono.d.ts declaring effectiveSpace, spaceRole, and isOwner
on Hono's ContextVariableMap. Remove 127 "as any" casts across 18
files. Fix ParticipantStatus type in rmaps SyncMessage union.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:25:29 -07:00
Jeff Emmett cc9a58b702 Move rforum, rtube, rtrips, rbooks to bottom of app switcher
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 03:08:33 +00:00
Jeff Emmett 9343dc13ab fix(routing): proxy /encryptid/* to encryptid container
The encryptid API routes live on the separate encryptid container, not
rspace. Clients on space subdomains (jeff.rspace.online) fetch
/encryptid/* relative to the rspace server. Add a catch-all proxy that
forwards these requests to the internal encryptid service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:47:39 -07:00
Jeff Emmett 058592f5e3 fix(rwallet): fix stuck loading, auth, and add Sepolia ERC20 tokens
- Add /encryptid/ to subdomain routing passthrough (was 404 on demo.rspace.online)
- Replace rwallet's custom JWT verify with SDK's verifyEncryptIDToken (supports
  remote fallback when JWT_SECRET unavailable in rspace container)
- Fix CRDT balance loading stuck spinner (early return skipped crdtLoading=false)
- Add Sepolia testnet ERC20 tokens (USDC, WETH, LINK)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:40:02 -07:00