import { readFile } from 'node:fs/promises'; import path from 'node:path'; /** * The 1-bit wordmark, inlined as a data URI. * * It is read from the committed `public/brand/logo-eink.png` and embedded in * the SVG rather than linked: the renderer must not depend on the network, and * an image the rasteriser silently failed to fetch would leave a hole in the * shop window. Regenerate the file with `npm run brand`. */ /** Matches the committed asset; see scripts/brand.ts. */ export const LOGO_WIDTH = 260; export const LOGO_HEIGHT = 36; let cached: string | null | undefined; export async function loadLogoDataUri(): Promise { if (cached !== undefined) { return cached; } try { const file = path.join(process.cwd(), 'public', 'brand', 'logo-eink.png'); cached = `data:image/png;base64,${(await readFile(file)).toString('base64')}`; } catch { // Not fatal: the header falls back to the shop name set in the settings, // which is worse-looking but still a working screen. cached = null; } return cached; }