mirror of
https://github.com/Tony0410/quietthanks.git
synced 2026-05-24 13:21:38 +08:00
- Add manifest.json for proper PWA installation - Add service worker (sw.js) for push notification handling - Add ServiceWorkerProvider to register SW and manage notifications - Generate PNG icons (192x192, 512x512) for iOS compatibility - Update settings to show notification status and test button - Use service worker showNotification for iOS Safari compatibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
27 lines
749 B
JavaScript
27 lines
749 B
JavaScript
import sharp from "sharp";
|
|
import { fileURLToPath } from "url";
|
|
import { dirname, join } from "path";
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
const publicDir = join(__dirname, "..", "public", "icons");
|
|
|
|
const svgPath = join(publicDir, "icon.svg");
|
|
const svgContent = readFileSync(svgPath, "utf-8");
|
|
|
|
async function generateIcons() {
|
|
const sizes = [192, 512];
|
|
|
|
for (const size of sizes) {
|
|
const outputPath = join(publicDir, `icon-${size}.png`);
|
|
await sharp(Buffer.from(svgContent))
|
|
.resize(size, size)
|
|
.png()
|
|
.toFile(outputPath);
|
|
console.log(`Generated ${outputPath}`);
|
|
}
|
|
}
|
|
|
|
generateIcons().catch(console.error);
|