fix: bare-domain module URLs now show landing pages instead of demo hub

rspace.online/{moduleId} was rewriting to /demo/{moduleId}, serving the
internal nav hub. Now calls renderModuleLanding() with the module's rich
landing page when available, falling back to demo rewrite otherwise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-30 22:24:12 -07:00
parent 2d39fcac1d
commit df202df06c
1 changed files with 10 additions and 2 deletions

View File

@ -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<WSData>({
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));