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();