refactor: replace ?view= query params with path-based routes in rSocials

/rsocials → canvas view (default)
/rsocials/scheduler → Postiz iframe
/rsocials/feed → demo feed / landing
/rsocials/landing → landing page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-04 21:19:27 -08:00
parent bc9f5bcfb4
commit 99749d8cf2
1 changed files with 47 additions and 45 deletions

View File

@ -512,54 +512,56 @@ function renderDemoFeedHTML(): string {
</div>`;
}
// ── Main page route ──
// ── Path-based sub-routes ──
routes.get("/scheduler", (c) => {
const space = c.req.param("space") || "demo";
return c.html(renderExternalAppShell({
title: `${space} — Postiz | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
appUrl: "https://social.jeffemmett.com",
appName: "Postiz",
theme: "dark",
}));
});
routes.get("/feed", (c) => {
const space = c.req.param("space") || "demo";
const isDemo = space === "demo";
const body = isDemo ? renderDemoFeedHTML() : renderLanding();
const styles = isDemo
? `<link rel="stylesheet" href="/modules/rsocials/socials.css">`
: `<style>${RICH_LANDING_CSS}</style>`;
return c.html(renderShell({
title: `${space} — Socials Feed | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
theme: "dark",
body,
styles,
}));
});
routes.get("/landing", (c) => {
const space = c.req.param("space") || "demo";
return c.html(renderShell({
title: `${space} — rSocials | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
theme: "dark",
body: renderLanding(),
styles: `<style>${RICH_LANDING_CSS}</style>`,
}));
});
// ── Default: canvas view ──
routes.get("/", (c) => {
const space = c.req.param("space") || "demo";
const view = c.req.query("view");
if (view === "app") {
return c.html(renderExternalAppShell({
title: `${space} — Postiz | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
appUrl: "https://social.jeffemmett.com",
appName: "Postiz",
theme: "dark",
}));
}
if (view === "feed") {
const isDemo = space === "demo";
const body = isDemo ? renderDemoFeedHTML() : renderLanding();
const styles = isDemo
? `<link rel="stylesheet" href="/modules/rsocials/socials.css">`
: `<style>${RICH_LANDING_CSS}</style>`;
return c.html(renderShell({
title: `${space} — Socials Feed | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
theme: "dark",
body,
styles,
}));
}
if (view === "landing") {
return c.html(renderShell({
title: `${space} — rSocials | rSpace`,
moduleId: "rsocials",
spaceSlug: space,
modules: getModuleInfoList(),
theme: "dark",
body: renderLanding(),
styles: `<style>${RICH_LANDING_CSS}</style>`,
}));
}
// Default: canvas view
return c.html(renderShell({
title: `${space} — rSocials | rSpace`,
moduleId: "rsocials",