diff --git a/nuxt.config.ts b/nuxt.config.ts index 8af97c0..b21234e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -16,6 +16,39 @@ export default defineNuxtConfig({ fallback: 'dark' }, + app: { + head: { + link: [ + { rel: 'icon', type: 'image/png', href: '/icons/icon-192.png' }, + { rel: 'apple-touch-icon', sizes: '192x192', href: '/apple-touch-icon.png' }, + { rel: 'manifest', href: '/manifest.webmanifest' } + ], + meta: [ + { name: 'theme-color', content: '#3f75d2' }, + { name: 'apple-mobile-web-app-capable', content: 'yes' }, + { name: 'mobile-web-app-capable', content: 'yes' }, + { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' } + ] + } + }, + + nitro: { + routeRules: { + '/manifest.webmanifest': { + headers: { + 'Content-Type': 'application/manifest+json', + 'Cache-Control': 'public, max-age=3600' + } + }, + '/sw.js': { + headers: { + 'Service-Worker-Allowed': '/', + 'Cache-Control': 'public, max-age=0' + } + } + } + }, + runtimeConfig: { // Variables privadas del servidor (no expuestas al cliente) printerHost: process.env.PRINTER_HOST || '192.168.87.147', @@ -31,17 +64,28 @@ export default defineNuxtConfig({ pwa: { registerType: 'autoUpdate', - includeAssets: ['favicon.ico', 'icon.png', 'icons/*.png'], + strategies: 'generateSW', + manifestFilename: 'manifest.webmanifest', + includeAssets: [ + 'favicon.ico', + 'icon.png', + 'apple-touch-icon.png', + 'icons/*.png' + ], manifest: { + id: '/?app=printercentral', name: 'Printer Central', short_name: 'Printer', description: 'Administra tus impresoras de forma facil y rapida.', theme_color: '#3f75d2', - background_color: '#ffffff', + background_color: '#1a1a2e', display: 'standalone', orientation: 'portrait', scope: '/', start_url: '/', + launch_handler: { + client_mode: 'navigate-existing' + }, icons: [ { src: '/icons/icon-72.png', @@ -90,8 +134,9 @@ export default defineNuxtConfig({ workbox: { navigateFallback: '/', navigateFallbackDenylist: [/^\/api\//], - globPatterns: ['**/*.{js,css,html,png,svg,ico,json,jpeg}'], + globPatterns: ['**/*.{js,css,html,png,svg,ico,json,jpeg,webp,woff2}'], cleanupOutdatedCaches: true, + maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, runtimeCaching: [ { // API calls siempre van a la red @@ -136,8 +181,12 @@ export default defineNuxtConfig({ } ] }, + client: { + installPrompt: true, + periodicSyncForUpdates: 3600 + }, devOptions: { - enabled: true, + enabled: process.env.NODE_ENV === 'development', type: 'module' } } diff --git a/pwa/icons/icon-192.png b/public/apple-touch-icon.png similarity index 100% rename from pwa/icons/icon-192.png rename to public/apple-touch-icon.png diff --git a/pwa/icon.png b/pwa/icon.png deleted file mode 100644 index 18170a4..0000000 Binary files a/pwa/icon.png and /dev/null differ diff --git a/pwa/icons/icon-128.png b/pwa/icons/icon-128.png deleted file mode 100644 index 69465ef..0000000 Binary files a/pwa/icons/icon-128.png and /dev/null differ diff --git a/pwa/icons/icon-144.png b/pwa/icons/icon-144.png deleted file mode 100644 index 186bc2d..0000000 Binary files a/pwa/icons/icon-144.png and /dev/null differ diff --git a/pwa/icons/icon-152.png b/pwa/icons/icon-152.png deleted file mode 100644 index ed534b0..0000000 Binary files a/pwa/icons/icon-152.png and /dev/null differ diff --git a/pwa/icons/icon-384.png b/pwa/icons/icon-384.png deleted file mode 100644 index 89adc10..0000000 Binary files a/pwa/icons/icon-384.png and /dev/null differ diff --git a/pwa/icons/icon-512.png b/pwa/icons/icon-512.png deleted file mode 100644 index 1893d4b..0000000 Binary files a/pwa/icons/icon-512.png and /dev/null differ diff --git a/pwa/icons/icon-72.png b/pwa/icons/icon-72.png deleted file mode 100644 index 7d98253..0000000 Binary files a/pwa/icons/icon-72.png and /dev/null differ diff --git a/pwa/icons/icon-96.png b/pwa/icons/icon-96.png deleted file mode 100644 index ecd10c0..0000000 Binary files a/pwa/icons/icon-96.png and /dev/null differ diff --git a/pwa/index.html b/pwa/index.html deleted file mode 100644 index a7a3a98..0000000 --- a/pwa/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Printer Central - - - - - - -
- -

Bienvenido a Printer Central

-

Administra tus impresoras de forma fácil y rápida.

- -
- - - - diff --git a/pwa/manifest.json b/pwa/manifest.json deleted file mode 100644 index a0436e2..0000000 --- a/pwa/manifest.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "Printer Central", - "short_name": "Printer", - "description": "Manage your printers from one central app.", - "start_url": "index.html", - "display": "standalone", - "background_color": "#ffffff", - "theme_color": "#3f75d2", - "icons": [ - { - "src": "icons/icon-72.png", - "sizes": "72x72", - "type": "image/png" - }, - { - "src": "icons/icon-96.png", - "sizes": "96x96", - "type": "image/png" - }, - { - "src": "icons/icon-128.png", - "sizes": "128x128", - "type": "image/png" - }, - { - "src": "icons/icon-144.png", - "sizes": "144x144", - "type": "image/png" - }, - { - "src": "icons/icon-152.png", - "sizes": "152x152", - "type": "image/png" - }, - { - "src": "icons/icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/icon-384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "icons/icon-512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} \ No newline at end of file diff --git a/pwa/sw.js b/pwa/sw.js deleted file mode 100644 index bacf9dd..0000000 --- a/pwa/sw.js +++ /dev/null @@ -1,49 +0,0 @@ -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); - } - })); - }) - ); -}); diff --git a/src/client/components/TopBar.vue b/src/client/components/TopBar.vue index b1ab540..b181058 100644 --- a/src/client/components/TopBar.vue +++ b/src/client/components/TopBar.vue @@ -1,7 +1,12 @@ @@ -12,6 +17,9 @@ .top { grid-area: header; } .glass { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 14px; } .card { padding: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.05); } +.header-content { display: flex; align-items: center; gap: 16px; } +.logo { width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0; } +.header-text { flex: 1; min-width: 0; } h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: 0.2px; } .subtle { color: var(--muted); margin: 0; }