From 0fbf12e5f8852e7e3ad60aa69cdea1181c7bbbd2 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 22 Mar 2026 11:24:39 -0700 Subject: [PATCH] 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 --- server/index.ts | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/server/index.ts b/server/index.ts index 4baedaf..d91e26a 100644 --- a/server/index.ts +++ b/server/index.ts @@ -78,10 +78,9 @@ import { vnbModule } from "../modules/rvnb/mod"; import { crowdsurfModule } from "../modules/crowdsurf/mod"; import { spaces, createSpace, resolveCallerRole, roleAtLeast } from "./spaces"; import type { SpaceRoleString } from "./spaces"; -import { renderShell, renderModuleLanding, renderSubPageInfo, renderOnboarding } from "./shell"; +import { renderShell, renderSubPageInfo, renderOnboarding } from "./shell"; import { renderOutputListPage } from "./output-list"; import { renderMainLanding, renderSpaceDashboard } from "./landing"; -import { fetchLandingPage } from "./landing-proxy"; import { syncServer } from "./sync-instance"; import { loadAllDocs } from "./local-first/doc-persistence"; import { backupRouter } from "./local-first/backup-routes"; @@ -2769,30 +2768,11 @@ const server = Bun.serve({ const mod = allModules.find((m) => m.id === firstSegment); if (mod) { - // rspace.online/{moduleId} → landing page + // rspace.online/{moduleId} → rewrite to /demo/{moduleId} (serve app in shell) if (pathSegments.length === 1) { - // 1. Check for inline rich landing page - if (mod.landingPage) { - const html = renderModuleLanding({ - module: mod, - modules: getModuleInfoList(), - bodyHTML: mod.landingPage(), - }); - return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8" } }); - } - // 2. Try proxying the rich standalone landing page - const proxyHtml = await fetchLandingPage(mod, getModuleInfoList()); - if (proxyHtml) { - return new Response(proxyHtml, { - headers: { "Content-Type": "text/html; charset=utf-8" }, - }); - } - // 3. Fallback to generic landing page - const html = renderModuleLanding({ - module: mod, - modules: getModuleInfoList(), - }); - return new Response(html, { headers: { "Content-Type": "text/html" } }); + const rewrittenPath = `/demo/${firstSegment}`; + const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`); + return app.fetch(new Request(rewrittenUrl, req)); } // rspace.online/{moduleId}/sub-path const secondSegment = pathSegments[1]?.toLowerCase();