From 8d8ae7e3517782bc04c05d07d06138fd00881f5c Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Fri, 20 Mar 2026 16:29:26 -0700 Subject: [PATCH] fix(rvote): serve demo at demo.rspace.online/rvote instead of /rvote/demo Extract demo body into renderDemoBody(), serve it from the / route when space=demo (which is what demo.rspace.online/rvote resolves to via subdomain routing). Legacy /demo path now 301-redirects to the canonical demo.rspace.online/rvote URL. Co-Authored-By: Claude Opus 4.6 --- modules/rvote/mod.ts | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/modules/rvote/mod.ts b/modules/rvote/mod.ts index 6ce422f..2ded13c 100644 --- a/modules/rvote/mod.ts +++ b/modules/rvote/mod.ts @@ -506,17 +506,10 @@ routes.post("/api/proposals/:id/final-vote", async (c) => { return c.json({ ok: true, tally }); }); -// ── Page routes ── +// ── Demo page body (reused by / when space=demo, and /demo fallback) ── -// Demo page — interactive polls with live sync -routes.get("/demo", (c) => { - return c.html(renderShell({ - title: "rVote Demo — Interactive Polls | rSpace", - moduleId: "rvote", - spaceSlug: "demo", - modules: getModuleInfoList(), - theme: "dark", - body: ` +function renderDemoBody(): string { + return `
Interactive Demo @@ -635,15 +628,33 @@ routes.get("/demo", (c) => { -
`, - scripts: ``, - styles: ``, - })); +
`; +} + +// ── Page routes ── + +// Legacy /demo path — redirect to demo.rspace.online/rvote +routes.get("/demo", (c) => { + return c.redirect("https://demo.rspace.online/rvote", 301); }); -// Dashboard — full voting app with spaces, proposals, conviction voting +// Main route — serves demo page when space=demo, dashboard otherwise routes.get("/", (c) => { const space = c.req.param("space") || "demo"; + + if (space === "demo") { + return c.html(renderShell({ + title: "rVote Demo — Interactive Polls | rSpace", + moduleId: "rvote", + spaceSlug: "demo", + modules: getModuleInfoList(), + theme: "dark", + body: renderDemoBody(), + scripts: ``, + styles: ``, + })); + } + return c.html(renderShell({ title: `${space} — Vote | rSpace`, moduleId: "rvote",