차량 모니터 서비스워커 인증 캐시 제외
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const CACHE_NAME = 'car-monitor-v1';
|
||||
const CACHE_NAME = 'car-monitor-v2';
|
||||
const CORE_ASSETS = [
|
||||
'/car/monitor.php',
|
||||
'/car/assets/favicon.svg',
|
||||
'/car/assets/icon-192.png',
|
||||
'/car/assets/icon-512.png',
|
||||
@@ -29,13 +28,18 @@ self.addEventListener('activate', event => {
|
||||
self.addEventListener('fetch', event => {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
if (url.origin !== location.origin || url.searchParams.get('mode') === 'ajax') {
|
||||
if (url.origin !== location.origin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.request.mode === 'navigate' || url.pathname.endsWith('.php') || url.searchParams.has('mode')) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then(response => {
|
||||
if (!response || !response.ok) return response;
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE_NAME).then(cache => cache.put(event.request, copy));
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user