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 @@ - - -
- - -Administra tus impresoras de forma fácil y rápida.
- -Construí tu formato concatenando comandos de impresión
+Construí tu formato concatenando comandos de impresión
+