Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
import { renderHome, renderCommands, renderNotFound, renderLlmsTxt } from './site.mjs';
import { renderBlogIndex, renderPost, renderFeed } from './blog.mjs';
import { POSTS_BY_SLUG, POSTS_NEWEST_FIRST } from './posts.mjs';
import { SITE } from './content.mjs';
import { SITE, FOOTER_LINKS } from './content.mjs';
import { createCrawlGate, crawlMiddleware } from './crawl.mjs';

const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
Expand Down Expand Up @@ -82,15 +82,19 @@ export function createApp({ crawlGate = createCrawlGate() } = {}) {
res.json({ status: 'ok', version: VERSION, commands: COMMANDS.commands.length }),
);

// Two footers fill the slots every page's foot() leaves, both server-side:
// <!--pfs-footer--> gets the shared Profullstack footer (webring + copyright)
// from @profullstack/footer's @latest template (the ring verifier reads raw
// HTML), and <!--pit-footer--> the pit.world global footer (cached 1 h,
// served stale or as nothing when pit.world is slow or down), last in <body>.
// Both inline <style>s get this response's nonce.
// The shared Profullstack footer is the one site footer; it carries the
// product links that used to live in site.mjs. The legacy network snippet
// stays last in the HTML and is suppressed by the shared template.
const withFooter = async (res, body) => {
const [ring, pit] = await Promise.all([
footerHtml({ site: 'https://moshcode.sh/', nonce: res.locals.nonce }),
footerHtml({
site: 'https://moshcode.sh/',
name: 'moshcode',
owner: { name: 'moshcode', url: 'https://moshcode.sh/' },
tagline: 'MIT licensed CLI for agentic coding',
links: FOOTER_LINKS,
nonce: res.locals.nonce,
}),
pitFooter(),
]);
const snippet = pit.replace(/<style>/g, `<style nonce="${res.locals.nonce}">`);
Expand Down
8 changes: 1 addition & 7 deletions src/site.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Server-side rendering for moshcode.sh. Every page is a string — no client
// framework, no hydration, one stylesheet and ~1KB of JS for the copy buttons.

import { SITE, NAV, ENGINES, STATS, SECTIONS, FOOTER_LINKS } from './content.mjs';
import { SITE, NAV, ENGINES, STATS, SECTIONS } from './content.mjs';

// head/foot/terminal/installBox/esc are exported for src/blog.mjs, which builds
// the blog pages out of the same chrome rather than a second set of markup.
Expand Down Expand Up @@ -109,12 +109,6 @@ export function adUnit() {

export function foot() {
return `</main>
<footer class="foot">
<div class="wrap foot-row">
<p class="brand"><span class="brand-mark" aria-hidden="true">▚</span> moshcode <span class="muted">· MIT licensed</span></p>
<nav aria-label="Footer">${FOOTER_LINKS.map((l) => `<a href="${esc(l.href)}">${esc(l.label)}</a>`).join('')}</nav>
</div>
</footer>
<!--pfs-footer-->
<script src="/app.js" defer></script>
<!--pit-footer-->
Expand Down
Loading