Mobile-first PWA: groups via key-in-fragment links, encrypted outbox and sync over SSE, all split modes, currencies with ECB rate prefill, photos, comments, history and rewind, stats, recurring expenses, CSV and backup, EN/CS, dark/light theme, Web Push decrypted in the service worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
// Render the PNG app icons from apps/web/public/icon.svg with headless
|
|
// Chromium (Playwright). Run after changing the SVG: node scripts/render-icons.mjs
|
|
import { chromium } from '@playwright/test';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const dir = new URL('../apps/web/public/', import.meta.url);
|
|
const svg = readFileSync(new URL('icon.svg', dir), 'utf8');
|
|
const b64 = Buffer.from(svg).toString('base64');
|
|
// Maskable: full-bleed background, artwork inside the 80% safe zone.
|
|
const maskable = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" fill="#0B2E22"/><image href="data:image/svg+xml;base64,${b64}" x="64" y="64" width="384" height="384"/></svg>`;
|
|
// Badge: white glyph on transparent (Android tints it).
|
|
const badge = svg.replace(/<rect[^>]*\/>/, '').replaceAll('#3DDC97', '#FFFFFF');
|
|
|
|
const jobs = [
|
|
['icon-192.png', svg, 192],
|
|
['icon-512.png', svg, 512],
|
|
['icon-maskable-512.png', maskable, 512],
|
|
['badge-96.png', badge, 96],
|
|
];
|
|
|
|
const browser = await chromium.launch();
|
|
const page = await browser.newPage();
|
|
for (const [name, src, size] of jobs) {
|
|
await page.setViewportSize({ width: size, height: size });
|
|
await page.setContent(`<style>html,body{margin:0;background:transparent}svg{width:${size}px;height:${size}px;display:block}</style>${src}`);
|
|
await page.screenshot({ path: new URL(name, dir).pathname, omitBackground: true });
|
|
}
|
|
await browser.close();
|
|
console.log('icons written');
|