// build-hd-gallery.mjs — an HD review page for the 28 posters. // // Brief: "I want access to a page that lets me see all the HD versions of these // and copy them to clipboard." // // What it gives you per poster: // • the FULL-RESOLUTION PNG (3000x3000), lazily loaded so the page opens fast // • Copy image -> the actual PNG bitmap on the clipboard, ready to paste // • Copy link -> its absolute URL // • Open PNG / Open HTML -> the raw artefacts // // Clipboard note: navigator.clipboard.write() needs a SECURE CONTEXT. Browsers // treat http://localhost as secure but NOT a bare LAN IP, so over // http://:8090 the image copy is unavailable — the page detects that and // says so rather than silently failing. Copy-link always works. // // node build-hd-gallery.mjs -> out/hd.html import { readFileSync, writeFileSync, existsSync, statSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, join } from 'node:path'; import { regionFor, sectionsOf } from './poster-regions.mjs'; const __dirname = dirname(fileURLToPath(import.meta.url)); const OUT = join(__dirname, 'out'); const manifest = JSON.parse(readFileSync(join(OUT, 'manifest.json'), 'utf8')); // Sections come from the SHARED region map (poster-regions.mjs), which the // preview gallery uses too — three copies of this mapping would drift. const posters = manifest.posters.map((p) => { const png = join(OUT, p.png); const kb = existsSync(png) ? Math.round(statSync(png).size / 1024) : 0; return { ...p, region: regionFor(p.zoneKey), kb }; }); const ordered = sectionsOf(posters); const esc = (s) => String(s).replace(/&/g, '&').replace(//g, '>'); const cards = ordered.map(({ name, list, total }) => `

${esc(name)} ${list.length} maps · ${total} people groups

${list.map((p) => `
${esc(p.title)}
${esc(p.title)}
${p.count} UPG · ${p.kb} KB · 3000×3000
PNG HTML
`).join('')}
`).join(''); const html = ` UPG-100 posters — HD review

UPG-100 posters — HD review

${posters.length} posters · 3000×3000 PNG · click a poster to open it full size
Image-copy needs a secure context — open this page via localhost (or HTTPS) to enable it. “Copy link” works anywhere.
${cards} `; writeFileSync(join(OUT, 'hd.html'), html); console.log(`[hd-gallery] ${posters.length} posters -> out/hd.html`);