diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts index e72d334..c71931e 100644 --- a/apps/server/src/index.ts +++ b/apps/server/src/index.ts @@ -28,6 +28,9 @@ export async function boot(options: { port?: number; listen?: boolean } = {}) { bundledRoot: join(REPO_ROOT, 'plugins'), baseUrl, }); + if (new URL(baseUrl).hostname === 'bbs.hqtui.com') { + await registry.setEnabled('profullstack-footer', true); + } const enabled = [...registry.enabled]; console.log(`[tsbb] plugins: ${enabled.length ? enabled.join(', ') : 'none enabled'}`); for (const [slug, error] of registry.errors) console.warn(`[tsbb] plugin ${slug}: ${error}`); diff --git a/packages/ui/src/components/layout.ts b/packages/ui/src/components/layout.ts index 9687199..b927354 100644 --- a/packages/ui/src/components/layout.ts +++ b/packages/ui/src/components/layout.ts @@ -106,6 +106,7 @@ function frontPageTitle(boardName: string, tagline?: string): string { */ export function Layout(props: LayoutProps) { const slots = props.slots ?? {}; + const universalFooter = slots.footer?.includes('data-pfs-footer') ?? false; const theme = props.theme ?? 'system'; const themeColor = props.themeColor ?? { light: '#fffcf9', dark: '#1a120c' }; const title = @@ -203,33 +204,29 @@ export function Layout(props: LayoutProps) { ${trusted(slots.header)}
${props.body}
- + ${universalFooter + ? trusted(slots.footer) + : html``} ${trusted(slots.bodyEnd)} diff --git a/plugins/profullstack-footer/package.json b/plugins/profullstack-footer/package.json index 4800029..7a6304d 100644 --- a/plugins/profullstack-footer/package.json +++ b/plugins/profullstack-footer/package.json @@ -5,7 +5,7 @@ "type": "module", "main": "./src/index.ts", "dependencies": { - "@profullstack/footer": "^0.2.6", + "@profullstack/footer": "latest", "@tsbb/plugin-api": "workspace:*" } } diff --git a/plugins/profullstack-footer/plugin.json b/plugins/profullstack-footer/plugin.json index 7158f47..2ded4c6 100644 --- a/plugins/profullstack-footer/plugin.json +++ b/plugins/profullstack-footer/plugin.json @@ -1,7 +1,7 @@ { "slug": "profullstack-footer", "name": "Profullstack Footer", - "description": "The Profullstack network footer: the << Profullstack >> webring row and the built.indie and pwamart badges. Off by default; for boards run by Profullstack.", + "description": "The shared Profullstack footer for the company board, with a remotely updated template and site-specific links.", "author": "Profullstack, Inc.", "homepage": "https://github.com/profullstack/footer", "license": "MIT" diff --git a/plugins/profullstack-footer/src/index.ts b/plugins/profullstack-footer/src/index.ts index 6473bb5..abe7b1a 100644 --- a/plugins/profullstack-footer/src/index.ts +++ b/plugins/profullstack-footer/src/index.ts @@ -2,9 +2,8 @@ import { definePlugin } from '@tsbb/plugin-api'; import { footerHtml, latestTemplate } from '@profullstack/footer'; /** - * The Profullstack network footer (@profullstack/footer), for boards that - * Profullstack runs: the << Profullstack >> webring row, the built.indie and - * pwamart badges and the copyright line, under the board's own footer. + * The Profullstack network footer (@profullstack/footer), enabled on + * bbs.hqtui.com as the board's footer and optional on other boards. * * Ships DISABLED. Joining a webring and showing someone else's badges is the * operator's choice, not something an upgrade should decide for every board. @@ -23,7 +22,7 @@ import { footerHtml, latestTemplate } from '@profullstack/footer'; * the board without a redeploy. */ -const BADGE_HOSTS = ['https://built.indie.pit.world', 'https://pwamart.com']; +const BADGE_HOSTS = ['https://logicsrc.com', 'https://profullstack.com']; export default definePlugin({ manifest: { @@ -31,7 +30,7 @@ export default definePlugin({ name: 'Profullstack Footer', version: '0.1.0', description: - 'The Profullstack network footer: webring row plus the built.indie and pwamart badges. Off by default; for boards run by Profullstack.', + 'The shared Profullstack footer with a remotely updated template and site-specific links.', author: 'Profullstack, Inc.', homepage: 'https://github.com/profullstack/footer', license: 'MIT', @@ -74,7 +73,23 @@ export default definePlugin({ 'layout:footer', async () => { const since = Number(ctx.settings.get('since') ?? 0); - return footerHtml({ site: site(), css: false, ...(since > 0 ? { since } : {}) }); + const memberSite = site(); + return footerHtml({ + site: memberSite, + css: false, + subscribe: false, + builtIndieHref: `https://built.indie.pit.world/for?site=${memberSite}`, + pwamartHref: `https://pwamart.com/for?site=${memberSite}`, + links: [ + { label: 'About', href: '/about' }, + { label: 'Members', href: '/members' }, + { label: 'Docs', href: '/docs' }, + { label: 'Feeds', href: '/feeds' }, + { label: 'RSS', href: '/feed.xml' }, + { label: 'GitHub', href: 'https://github.com/profullstack/tsbb' }, + ], + ...(since > 0 ? { since } : {}), + }); }, // Last in the footer, below anything another plugin puts there. 1000, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43487dd..a47edde 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,8 +232,8 @@ importers: plugins/profullstack-footer: dependencies: '@profullstack/footer': - specifier: ^0.2.6 - version: 0.2.6 + specifier: latest + version: 0.6.9 '@tsbb/plugin-api': specifier: workspace:* version: link:../../packages/plugin-api @@ -636,8 +636,8 @@ packages: engines: {node: '>=20'} hasBin: true - '@profullstack/footer@0.2.6': - resolution: {integrity: sha512-BKwbDszAc7e0mYIBiPjgr/5WS8WyDt8IW718s/zW/8pCWOIB1BGwSNs6fmImRSo5kqIjQKUVbXp22jZQ5GEipA==} + '@profullstack/footer@0.6.9': + resolution: {integrity: sha512-IlLCHq4QHXI6Vj+69o+AC4ZNVSxr/9l+ycC/+Fv3dr5wie8d2mUT/b3go5HH+JmJArW6qE+pa/pRmWJAs0JoYg==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -1080,7 +1080,7 @@ snapshots: '@profullstack/bridges@0.2.0': {} - '@profullstack/footer@0.2.6': {} + '@profullstack/footer@0.6.9': {} '@profullstack/hqtui@0.5.0': {} diff --git a/test/plugins.test.ts b/test/plugins.test.ts index 5d42c65..dad2e89 100644 --- a/test/plugins.test.ts +++ b/test/plugins.test.ts @@ -120,8 +120,10 @@ describe('the plugin host', () => { const response = await app.fetch(new Request(url('/'))); body = await response.text(); assert.ok(body.includes('rssamplifier.com/ring/profullstack'), 'the webring row is in the HTML'); - assert.ok(body.includes('built.indie.pit.world/for.svg?site=https://tsbb.dev/'), 'built.indie badge'); - assert.ok(body.includes('pwamart.com/for.svg'), 'pwamart badge'); + assert.ok(body.includes('href="https://built.indie.pit.world/for?site=https://tsbb.dev/"'), 'built.indie badge link'); + assert.ok(body.includes('src="https://logicsrc.com/openicon/set/hq/svg/built-indie.svg"'), 'built.indie icon'); + assert.ok(body.includes('href="https://pwamart.com/for?site=https://tsbb.dev/"'), 'pwamart badge link'); + assert.ok(body.includes('src="https://logicsrc.com/openicon/set/hq/svg/pwamart.svg"'), 'pwamart icon'); assert.ok(!/]*>\.pfs-footer/.test(body), 'no inline footer style: style-src has no unsafe-inline'); assert.ok(body.includes('/p/profullstack-footer/footer.css'), 'the CSS comes from the board');