mirror of
https://github.com/Tony0410/quietthanks.git
synced 2026-05-24 21:31:41 +08:00
Add PWA infrastructure for iOS notification support
- 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>
This commit is contained in:
26
scripts/generate-icons.mjs
Normal file
26
scripts/generate-icons.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user