diff --git a/frontend/index.html b/frontend/index.html index 46d44fc..9dfd1ce 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,11 +3,13 @@ - RADIUS Dashboard + radiusNucleo + + +
- diff --git a/frontend/public/icons/icon-192-black.png b/frontend/public/icons/icon-192-black.png new file mode 100644 index 0000000..946c7cc Binary files /dev/null and b/frontend/public/icons/icon-192-black.png differ diff --git a/frontend/public/icons/icon-192-maskable.png b/frontend/public/icons/icon-192-maskable.png new file mode 100644 index 0000000..6098712 Binary files /dev/null and b/frontend/public/icons/icon-192-maskable.png differ diff --git a/frontend/public/icons/icon-192.png b/frontend/public/icons/icon-192.png new file mode 100644 index 0000000..6098712 Binary files /dev/null and b/frontend/public/icons/icon-192.png differ diff --git a/frontend/public/icons/icon-512-black.png b/frontend/public/icons/icon-512-black.png new file mode 100644 index 0000000..4128554 Binary files /dev/null and b/frontend/public/icons/icon-512-black.png differ diff --git a/frontend/public/icons/icon-512-maskable.png b/frontend/public/icons/icon-512-maskable.png new file mode 100644 index 0000000..86f075b Binary files /dev/null and b/frontend/public/icons/icon-512-maskable.png differ diff --git a/frontend/public/icons/icon-512.png b/frontend/public/icons/icon-512.png new file mode 100644 index 0000000..86f075b Binary files /dev/null and b/frontend/public/icons/icon-512.png differ diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 0000000..37b90fa --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,57 @@ +{ + "name": "RADIUS Nucleo", + "short_name": "RADIUS", + "description": "Aplicación PWA para administrar usuarios y dispositivos usando FreeRADIUS.", + "start_url": "/index.html", + "display": "standalone", + "background_color": "#000000", + "theme_color": "#000000", + "icons": [ + { + "src": "icons/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/icon-192-maskable.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/icon-512-maskable.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/icon-192-black.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/icon-512-black.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "screenshots": [ + { + "src": "screenshots/screenshot-desktop.png", + "sizes": "2048x1229", + "type": "image/png", + "form_factor": "wide" + }, + { + "src": "screenshots/screenshot-mobile.png", + "sizes": "797x1220", + "type": "image/png", + "form_factor": "narrow" + } + ] +} \ No newline at end of file diff --git a/frontend/public/screenshots/screenshot-desktop.png b/frontend/public/screenshots/screenshot-desktop.png new file mode 100644 index 0000000..059f843 Binary files /dev/null and b/frontend/public/screenshots/screenshot-desktop.png differ diff --git a/frontend/public/screenshots/screenshot-mobile.png b/frontend/public/screenshots/screenshot-mobile.png new file mode 100644 index 0000000..12aebea Binary files /dev/null and b/frontend/public/screenshots/screenshot-mobile.png differ diff --git a/frontend/public/sw.js b/frontend/public/sw.js new file mode 100644 index 0000000..c551f71 --- /dev/null +++ b/frontend/public/sw.js @@ -0,0 +1,39 @@ +// Nombre del caché para la aplicación +const CACHE_NAME = 'radius-nucleo-cache-v1'; + +// Archivos que se almacenarán en caché durante la instalación +const URLS_TO_CACHE = [ + '/', + '/index.html', + '/manifest.json', + '/sw.js', + // Iconos + '/icons/icon-192.png', + '/icons/icon-512.png', + '/icons/icon-192-maskable.png', + '/icons/icon-512-maskable.png', + '/icons/icon-192-black.png', + '/icons/icon-512-black.png', + // Capturas de pantalla + '/screenshots/screenshot-desktop.png', + '/screenshots/screenshot-mobile.png' +]; + +// Evento de instalación: almacena los archivos definidos en la caché +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME) + .then((cache) => cache.addAll(URLS_TO_CACHE)) + ); +}); + +// Evento de recuperación (fetch): responde desde la caché si existe, si no, recupera de la red +self.addEventListener('fetch', (event) => { + event.respondWith( + caches.match(event.request) + .then((response) => { + // Devuelve la respuesta en caché o realiza la solicitud a la red + return response || fetch(event.request); + }) + ); +}); \ No newline at end of file diff --git a/frontend/src/main.js b/frontend/src/main.js index 1570ac0..9b680f9 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -4,3 +4,10 @@ import './styles.css'; const app = createApp(App); app.mount('#app'); + +// Register Service Worker for PWA (in production) +if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('/sw.js').catch(() => {}); + }); +} diff --git a/package.json b/package.json index bf2e9f6..377c613 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "0.1.0", "private": true, "scripts": { - "predev": "npm --prefix frontend install && npm --prefix frontend run build", + "predev": "npm --prefix frontend install && find frontend/public -name '*:Zone.Identifier' -delete || true && npm --prefix frontend run build", "dev": "docker compose up -d --build", - "prerestart": "npm --prefix frontend install && npm --prefix frontend run build", + "prerestart": "npm --prefix frontend install && find frontend/public -name '*:Zone.Identifier' -delete || true && npm --prefix frontend run build", "restart": "docker compose up -d --build --force-recreate", "hot": "docker compose up -d node", "logs": "docker compose logs -f",