From 9b13e3545c1cafac243dc0ffdd19dc84397f590f Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Wed, 24 Jun 2026 10:09:20 +0000 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20autom=C3=A1tica=20-=202?= =?UTF-8?q?026-06-24=2010:09:20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/manifest.json | 14 +------------- public/sw.js | 43 ++++++++++++++++--------------------------- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index e41d2d9..db0fe41 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,17 +6,5 @@ "display": "standalone", "background_color": "#0f172a", "theme_color": "#1e40af", - "orientation": "portrait-primary", - "icons": [ - { - "src": "/icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/icon-512.png", - "sizes": "512x512", - "type": "image/png" - } - ] + "orientation": "portrait-primary" } \ No newline at end of file diff --git a/public/sw.js b/public/sw.js index c8391c4..32f0757 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,35 +1,24 @@ -const CACHE_NAME = 'steelcheck-v1'; -const ASSETS = [ - '/', - '/index.html', - '/index.tsx', - '/style.css' -]; +const CACHE_NAME = 'steelcheck-v2'; -self.addEventListener('install', (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - return cache.addAll(ASSETS); - }) - ); +self.addEventListener('install', (e) => { + self.skipWaiting(); }); -self.addEventListener('fetch', (event) => { - event.respondWith( - caches.match(event.request).then((response) => { - return response || fetch(event.request); - }) - ); -}); - -self.addEventListener('activate', (event) => { - event.waitUntil( +self.addEventListener('activate', (e) => { + e.waitUntil( caches.keys().then((cacheNames) => { return Promise.all( - cacheNames - .filter((name) => name !== CACHE_NAME) - .map((name) => caches.delete(name)) + cacheNames.map((cacheName) => { + return caches.delete(cacheName); + }) ); + }).then(() => { + return self.clients.claim(); }) ); -}); \ No newline at end of file +}); + +self.addEventListener('fetch', (e) => { + // Always fetch from network to avoid caching old index.html + e.respondWith(fetch(e.request)); +});