All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 36s
- Ruta /api/mcp agregada a rutas públicas de Traefik - Validación de token Bearer en el endpoint - Token configurado como secret MCP_AUTH_TOKEN
50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
const CACHE_NAME = 'printer-central-cache-v1';
|
|
const urlsToCache = [
|
|
'index.html',
|
|
'manifest.json',
|
|
'icon.png',
|
|
'icons/icon-72.png',
|
|
'icons/icon-96.png',
|
|
'icons/icon-128.png',
|
|
'icons/icon-144.png',
|
|
'icons/icon-152.png',
|
|
'icons/icon-192.png',
|
|
'icons/icon-384.png',
|
|
'icons/icon-512.png'
|
|
];
|
|
|
|
self.addEventListener('install', event => {
|
|
event.waitUntil(
|
|
caches.open(CACHE_NAME)
|
|
.then(cache => {
|
|
return cache.addAll(urlsToCache);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', event => {
|
|
event.respondWith(
|
|
caches.match(event.request)
|
|
.then(response => {
|
|
// Cache hit - return response
|
|
if (response) {
|
|
return response;
|
|
}
|
|
return fetch(event.request);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('activate', event => {
|
|
const cacheWhitelist = [CACHE_NAME];
|
|
event.waitUntil(
|
|
caches.keys().then(keyList => {
|
|
return Promise.all(keyList.map(key => {
|
|
if (cacheWhitelist.indexOf(key) === -1) {
|
|
return caches.delete(key);
|
|
}
|
|
}));
|
|
})
|
|
);
|
|
});
|