Compare commits

...

2 Commits

Author SHA1 Message Date
Jeff Emmett 31c93920a6 Merge branch 'dev' 2026-02-27 12:37:21 -08:00
Jeff Emmett 763f897c11 fix: rspace.online/r* now renders same shell as r*.online
Instead of serving a special iframe landing page, bare-domain module
paths now rewrite to /demo/{moduleId} — identical to standalone domains.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 12:37:05 -08:00
1 changed files with 4 additions and 18 deletions

View File

@ -64,7 +64,7 @@ import { splatModule } from "../modules/splat/mod";
import { photosModule } from "../modules/photos/mod";
import { rsocialsModule } from "../modules/rsocials/mod";
import { spaces } from "./spaces";
import { renderShell, renderModuleLanding } from "./shell";
import { renderShell } from "./shell";
import { syncServer } from "./sync-instance";
import { loadAllDocs } from "./local-first/doc-persistence";
@ -780,29 +780,15 @@ const server = Bun.serve<WSData>({
return app.fetch(rewrittenReq);
}
// ── Bare-domain module routes: rspace.online/{moduleId} ──
// Exact module path → embed standalone domain in iframe (avoids CORS).
// Sub-paths (API, assets) → rewrite to /demo/{moduleId}/... for backward compat.
// ── Bare-domain module routes: rspace.online/{moduleId}[/...] ──
// Rewrite to /demo/{moduleId}/... so the normal shell renders identically
// to how standalone domains (e.g. rtube.online) serve their content.
if (!subdomain && hostClean.includes("rspace.online")) {
const pathSegments = url.pathname.split("/").filter(Boolean);
if (pathSegments.length >= 1) {
const firstSegment = pathSegments[0];
const knownModuleIds = new Set(getAllModules().map((m) => m.id));
if (knownModuleIds.has(firstSegment)) {
// Exact module path → landing page with iframe embed
if (pathSegments.length === 1) {
const modInfo = getModuleInfoList().find((m) => m.id === firstSegment);
if (modInfo) {
return new Response(
renderModuleLanding({
module: modInfo,
modules: getModuleInfoList(),
}),
{ headers: { "Content-Type": "text/html; charset=utf-8" } },
);
}
}
// Sub-paths → rewrite to demo space
const rewrittenPath = `/demo${url.pathname}`;
const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`);
const rewrittenReq = new Request(rewrittenUrl, req);