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:
parent
2d39fcac1d
commit
df202df06c
|
|
@ -84,7 +84,7 @@ import { vnbModule } from "../modules/rvnb/mod";
|
||||||
import { crowdsurfModule } from "../modules/crowdsurf/mod";
|
import { crowdsurfModule } from "../modules/crowdsurf/mod";
|
||||||
import { spaces, createSpace, resolveCallerRole, roleAtLeast } from "./spaces";
|
import { spaces, createSpace, resolveCallerRole, roleAtLeast } from "./spaces";
|
||||||
import type { SpaceRoleString } 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 { renderOutputListPage } from "./output-list";
|
||||||
import { renderMainLanding, renderSpaceDashboard } from "./landing";
|
import { renderMainLanding, renderSpaceDashboard } from "./landing";
|
||||||
import { syncServer } from "./sync-instance";
|
import { syncServer } from "./sync-instance";
|
||||||
|
|
@ -3291,8 +3291,16 @@ const server = Bun.serve<WSData>({
|
||||||
const mod = allModules.find((m) => m.id === firstSegment);
|
const mod = allModules.find((m) => m.id === firstSegment);
|
||||||
|
|
||||||
if (mod) {
|
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 (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 rewrittenPath = `/demo/${firstSegment}`;
|
||||||
const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`);
|
const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`);
|
||||||
return app.fetch(new Request(rewrittenUrl, req));
|
return app.fetch(new Request(rewrittenUrl, req));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue