fix(rpast): serve interactive viewer at space root
Adds `GET /` to rpast routes. Without it, /rpast on a space subdomain 404'd because the sub-app had no root handler. Now matches the rNotes pattern: bare domain → marketing landing, in-space URL → app shell with <rpast-viewer>.
This commit is contained in:
parent
d950e1a656
commit
14ffee4101
|
|
@ -12,11 +12,30 @@ import {
|
||||||
enumerateCreations, listCreationEnumerators, renderMarkwhen,
|
enumerateCreations, listCreationEnumerators, renderMarkwhen,
|
||||||
} from '../../shared/markwhen';
|
} from '../../shared/markwhen';
|
||||||
import { renderMarkwhenHtml } from '../../shared/markwhen/html-render';
|
import { renderMarkwhenHtml } from '../../shared/markwhen/html-render';
|
||||||
|
import { renderShell } from '../../server/shell';
|
||||||
|
import { getModuleInfoList } from '../../shared/module';
|
||||||
import { pastSchema } from './schemas';
|
import { pastSchema } from './schemas';
|
||||||
import { renderLanding } from './landing';
|
import { renderLanding } from './landing';
|
||||||
|
|
||||||
const routes = new Hono();
|
const routes = new Hono();
|
||||||
|
|
||||||
|
// GET / — marketing landing on bare domain, interactive viewer in a space.
|
||||||
|
routes.get('/', c => {
|
||||||
|
const space = c.req.param('space') || 'demo';
|
||||||
|
if (!space || space === 'rpast.online') {
|
||||||
|
return c.html(renderLanding());
|
||||||
|
}
|
||||||
|
return c.html(renderShell({
|
||||||
|
title: `${space} — rPast | rSpace`,
|
||||||
|
moduleId: 'rpast',
|
||||||
|
spaceSlug: space,
|
||||||
|
modules: getModuleInfoList(),
|
||||||
|
theme: 'dark',
|
||||||
|
body: `<rpast-viewer space="${space}" style="height:calc(100vh - 52px);display:block"></rpast-viewer>`,
|
||||||
|
scripts: `<script type="module" src="/modules/rpast/rpast-viewer.js?v=1"></script>`,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
routes.get('/api/modules', c => {
|
routes.get('/api/modules', c => {
|
||||||
return c.json(listCreationEnumerators().map(e => ({
|
return c.json(listCreationEnumerators().map(e => ({
|
||||||
module: e.module, label: e.label, icon: e.icon, color: e.color,
|
module: e.module, label: e.label, icon: e.icon, color: e.color,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue