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,13 +512,10 @@ function renderDemoFeedHTML(): string {
</div>`; </div>`;
} }
// ── Main page route ── // ── Path-based sub-routes ──
routes.get("/", (c) => { routes.get("/scheduler", (c) => {
const space = c.req.param("space") || "demo"; const space = c.req.param("space") || "demo";
const view = c.req.query("view");
if (view === "app") {
return c.html(renderExternalAppShell({ return c.html(renderExternalAppShell({
title: `${space} — Postiz | rSpace`, title: `${space} — Postiz | rSpace`,
moduleId: "rsocials", moduleId: "rsocials",
@ -528,9 +525,10 @@ routes.get("/", (c) => {
appName: "Postiz", appName: "Postiz",
theme: "dark", theme: "dark",
})); }));
} });
if (view === "feed") { routes.get("/feed", (c) => {
const space = c.req.param("space") || "demo";
const isDemo = space === "demo"; const isDemo = space === "demo";
const body = isDemo ? renderDemoFeedHTML() : renderLanding(); const body = isDemo ? renderDemoFeedHTML() : renderLanding();
const styles = isDemo const styles = isDemo
@ -545,9 +543,10 @@ routes.get("/", (c) => {
body, body,
styles, styles,
})); }));
} });
if (view === "landing") { routes.get("/landing", (c) => {
const space = c.req.param("space") || "demo";
return c.html(renderShell({ return c.html(renderShell({
title: `${space} — rSocials | rSpace`, title: `${space} — rSocials | rSpace`,
moduleId: "rsocials", moduleId: "rsocials",
@ -557,9 +556,12 @@ routes.get("/", (c) => {
body: renderLanding(), body: renderLanding(),
styles: `<style>${RICH_LANDING_CSS}</style>`, styles: `<style>${RICH_LANDING_CSS}</style>`,
})); }));
} });
// Default: canvas view // ── Default: canvas view ──
routes.get("/", (c) => {
const space = c.req.param("space") || "demo";
return c.html(renderShell({ return c.html(renderShell({
title: `${space} — rSocials | rSpace`, title: `${space} — rSocials | rSpace`,
moduleId: "rsocials", moduleId: "rsocials",