Changeset 69815b2 in Klonkt for src/server.js


Ignore:
Timestamp:
06/24/2026 05:26:24 AM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
6bd25d1
Parents:
5eef817
Message:

feat: auto-generated per-site OG image from palette + accent

New OgImageService renders a themed 1200x630 social card (palette gradient +
accent + site title/tagline + klonkt wordmark) via @resvg/resvg-js, cached on
disk. Served at GET /og/:slug.png and used as the default og:image/twitter:image
when a site has no custom share image — so every site gets a branded preview.
Bundles a static Fraunces TTF for rendering; graceful no-op if resvg can't load.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/server.js

    r5eef817 r69815b2  
    6363import adminEpkRoutes from './routes/admin-epk.js';
    6464import changelogRoutes from './routes/changelog.js';
     65import ogRoutes from './routes/og.js';
    6566
    6667// SESSION_SECRET: use the env var if set. Otherwise auto-generate a strong one
     
    222223app.use(federationRoutes);
    223224
     225// Themed OG cards (/og/:slug.png) — resolve the site by slug themselves, so they
     226// run before resolveSite and need no site context.
     227app.use('/og', ogRoutes);
     228
    224229app.use(resolveSite);
    225230app.use(loadAudioTracks);
Note: See TracChangeset for help on using the changeset viewer.