Compare commits
No commits in common. "31c93920a6ef410824e0c38de0c905b5381a28ef" and "29df97ccc84f4b23977dcdb249b1ee0599178802" have entirely different histories.
31c93920a6
...
29df97ccc8
|
|
@ -64,7 +64,7 @@ import { splatModule } from "../modules/splat/mod";
|
||||||
import { photosModule } from "../modules/photos/mod";
|
import { photosModule } from "../modules/photos/mod";
|
||||||
import { rsocialsModule } from "../modules/rsocials/mod";
|
import { rsocialsModule } from "../modules/rsocials/mod";
|
||||||
import { spaces } from "./spaces";
|
import { spaces } from "./spaces";
|
||||||
import { renderShell } from "./shell";
|
import { renderShell, renderModuleLanding } from "./shell";
|
||||||
import { syncServer } from "./sync-instance";
|
import { syncServer } from "./sync-instance";
|
||||||
import { loadAllDocs } from "./local-first/doc-persistence";
|
import { loadAllDocs } from "./local-first/doc-persistence";
|
||||||
|
|
||||||
|
|
@ -780,15 +780,29 @@ const server = Bun.serve<WSData>({
|
||||||
return app.fetch(rewrittenReq);
|
return app.fetch(rewrittenReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Bare-domain module routes: rspace.online/{moduleId}[/...] ──
|
// ── Bare-domain module routes: rspace.online/{moduleId} ──
|
||||||
// Rewrite to /demo/{moduleId}/... so the normal shell renders identically
|
// Exact module path → embed standalone domain in iframe (avoids CORS).
|
||||||
// to how standalone domains (e.g. rtube.online) serve their content.
|
// Sub-paths (API, assets) → rewrite to /demo/{moduleId}/... for backward compat.
|
||||||
if (!subdomain && hostClean.includes("rspace.online")) {
|
if (!subdomain && hostClean.includes("rspace.online")) {
|
||||||
const pathSegments = url.pathname.split("/").filter(Boolean);
|
const pathSegments = url.pathname.split("/").filter(Boolean);
|
||||||
if (pathSegments.length >= 1) {
|
if (pathSegments.length >= 1) {
|
||||||
const firstSegment = pathSegments[0];
|
const firstSegment = pathSegments[0];
|
||||||
const knownModuleIds = new Set(getAllModules().map((m) => m.id));
|
const knownModuleIds = new Set(getAllModules().map((m) => m.id));
|
||||||
if (knownModuleIds.has(firstSegment)) {
|
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 rewrittenPath = `/demo${url.pathname}`;
|
||||||
const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`);
|
const rewrittenUrl = new URL(rewrittenPath + url.search, `http://localhost:${PORT}`);
|
||||||
const rewrittenReq = new Request(rewrittenUrl, req);
|
const rewrittenReq = new Request(rewrittenUrl, req);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue