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>
This commit is contained in:
parent
63c1b7c1e7
commit
0fbf12e5f8
|
|
@ -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<WSData>({
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue