Initial JPEG photo metadata editor v0.1

This commit is contained in:
dmo committed 2026-07-23 01:10:49 +02:00
1 parent cdc206680c
commit 8738b8c814
12 files changed
+1222

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
const CACHE_NAME = 'photo-date-editor-v1';
const SHELL = ['/', '/styles.css', '/app.js', '/manifest.webmanifest'];
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL)));
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
);
self.clients.claim();
});
self.addEventListener('fetch', (event) => {
if (event.request.method !== 'GET' || new URL(event.request.url).pathname.startsWith('/api/')) return;
event.respondWith(
fetch(event.request).then((response) => {
const copy = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, copy));
return response;
}).catch(() => caches.match(event.request))
);
});