From 7c80f5ce7e44b95d16e19de40de0f8079377c6b9 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 22 Aug 2026 19:21:12 +0900 Subject: Initial commit: todo app with passkey auth and PWA support Co-Authored-By: Claude Sonnet 4.6 --- public/icons/icon-192.png | Bin 0 -> 1099 bytes public/icons/icon-512.png | Bin 0 -> 3683 bytes public/manifest.json | 13 +++++++++++++ public/sw.js | 26 ++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 public/icons/icon-192.png create mode 100644 public/icons/icon-512.png create mode 100644 public/manifest.json create mode 100644 public/sw.js (limited to 'public') diff --git a/public/icons/icon-192.png b/public/icons/icon-192.png new file mode 100644 index 0000000..75d6fc6 Binary files /dev/null and b/public/icons/icon-192.png differ diff --git a/public/icons/icon-512.png b/public/icons/icon-512.png new file mode 100644 index 0000000..a9b3d12 Binary files /dev/null and b/public/icons/icon-512.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..0829b4a --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "Todo", + "short_name": "Todo", + "description": "個人用タスク管理", + "start_url": "/", + "display": "standalone", + "background_color": "#111827", + "theme_color": "#6c63ff", + "icons": [ + { "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" }, + { "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" } + ] +} diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..f4e6631 --- /dev/null +++ b/public/sw.js @@ -0,0 +1,26 @@ +const CACHE = "todo-v1"; +const PRECACHE = ["/manifest.json", "/icons/icon-192.png", "/icons/icon-512.png"]; + +self.addEventListener("install", (e) => { + e.waitUntil(caches.open(CACHE).then((c) => c.addAll(PRECACHE))); + self.skipWaiting(); +}); + +self.addEventListener("activate", (e) => { + e.waitUntil( + caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))) + ); + self.clients.claim(); +}); + +self.addEventListener("fetch", (e) => { + const url = new URL(e.request.url); + if (url.pathname.startsWith("/icons/") || url.pathname === "/manifest.json") { + e.respondWith(caches.match(e.request).then((r) => r || fetch(e.request))); + return; + } + // Network-first for everything else (SSR pages, API) + e.respondWith( + fetch(e.request).catch(() => caches.match(e.request)) + ); +}); -- cgit v1.2.3