fix3
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 13s

This commit is contained in:
2025-10-17 05:31:56 -06:00
parent 61d8908daa
commit 3b36a3e3a7
2 changed files with 27 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
version: "3.9" version: "3.9"
services: services:
@@ -35,8 +36,8 @@
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.responseforwarding.flushinterval=1ms" - "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.responseforwarding.flushinterval=1ms"
- "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.serverstransport=wifi-transport@file" - "traefik.http.services.wifi-nucleoriofrio-service.loadbalancer.serverstransport=wifi-transport@file"
# Router 1: Público (assets estáticos, manifest, icons) - SIN autenticación - ALTA PRIORIDAD # Router 1: Público (assets, manifest, icons, callback de Authentik) - SIN autenticación - ALTA PRIORIDAD
- "traefik.http.routers.wifi-nucleoriofrio-public.rule=Host(`wifi.nucleoriofrio.com`) && (PathPrefix(`/assets`) || PathPrefix(`/.well-known`) || PathPrefix(`/icons`) || Path(`/manifest.webmanifest`) || Path(`/favicon.ico`) || Path(`/vite.svg`))" - "traefik.http.routers.wifi-nucleoriofrio-public.rule=Host(`wifi.nucleoriofrio.com`) && (PathPrefix(`/assets`) || PathPrefix(`/.well-known`) || PathPrefix(`/icons`) || PathPrefix(`/outpost.goauthentik.io`) || Path(`/manifest.webmanifest`) || Path(`/favicon.ico`) || Path(`/vite.svg`) || Path(`/sw.js`))"
- "traefik.http.routers.wifi-nucleoriofrio-public.entrypoints=websecure" - "traefik.http.routers.wifi-nucleoriofrio-public.entrypoints=websecure"
- "traefik.http.routers.wifi-nucleoriofrio-public.tls.certresolver=letsencrypt" - "traefik.http.routers.wifi-nucleoriofrio-public.tls.certresolver=letsencrypt"
- "traefik.http.routers.wifi-nucleoriofrio-public.service=wifi-nucleoriofrio-service" - "traefik.http.routers.wifi-nucleoriofrio-public.service=wifi-nucleoriofrio-service"

View File

@@ -1,5 +1,5 @@
// Nombre del caché para la aplicación // Nombre del caché para la aplicación
const CACHE_NAME = 'radius-nucleo-cache-v1'; const CACHE_NAME = 'radius-nucleo-cache-v2';
// Archivos que se almacenarán en caché durante la instalación // Archivos que se almacenarán en caché durante la instalación
const URLS_TO_CACHE = [ const URLS_TO_CACHE = [
@@ -27,8 +27,31 @@ self.addEventListener('install', (event) => {
); );
}); });
// Evento de activación: limpia los caches antiguos
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(
cacheNames.map((cacheName) => {
if (cacheName !== CACHE_NAME) {
return caches.delete(cacheName);
}
})
);
})
);
});
// Evento de recuperación (fetch): responde desde la caché si existe, si no, recupera de la red // Evento de recuperación (fetch): responde desde la caché si existe, si no, recupera de la red
self.addEventListener('fetch', (event) => { self.addEventListener('fetch', (event) => {
// Excluir las peticiones a /api/* del Service Worker
// Estas peticiones requieren autenticación y no deben ser cacheadas
const url = new URL(event.request.url);
if (url.pathname.startsWith('/api/')) {
// Dejar que el navegador maneje las peticiones de API normalmente
return;
}
event.respondWith( event.respondWith(
caches.match(event.request) caches.match(event.request)
.then((response) => { .then((response) => {