diff --git a/server/index.ts b/server/index.ts index 86f092c..bd9d23e 100644 --- a/server/index.ts +++ b/server/index.ts @@ -84,7 +84,7 @@ 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, renderSubPageInfo, renderOnboarding, setFragmentMode } from "./shell"; +import { renderShell, renderSubPageInfo, renderModuleLanding, renderOnboarding, setFragmentMode } from "./shell"; import { renderOutputListPage } from "./output-list"; import { renderMainLanding, renderSpaceDashboard } from "./landing"; import { syncServer } from "./sync-instance"; @@ -3291,8 +3291,16 @@ const server = Bun.serve({ const mod = allModules.find((m) => m.id === firstSegment); if (mod) { - // rspace.online/{moduleId} → rewrite to /demo/{moduleId} (serve app in shell) + // rspace.online/{moduleId} → show module landing page (or fallback to demo shell) if (pathSegments.length === 1) { + 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" } }); + } const rewrittenPath = `/demo/${firstSegment}`; const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`); return app.fetch(new Request(rewrittenUrl, req));