All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 37s
- Agregar iconos en todos los tamanos (72-512px) - Actualizar manifest con colores y metadata correctos - Configurar workbox para caching optimo
145 lines
3.8 KiB
TypeScript
145 lines
3.8 KiB
TypeScript
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
export default defineNuxtConfig({
|
|
compatibilityDate: '2025-07-15',
|
|
devtools: { enabled: true },
|
|
|
|
modules: [
|
|
'@nuxt/ui',
|
|
'@vite-pwa/nuxt'
|
|
],
|
|
|
|
css: ['~/assets/css/main.css'],
|
|
|
|
colorMode: {
|
|
classSuffix: '',
|
|
preference: 'dark',
|
|
fallback: 'dark'
|
|
},
|
|
|
|
runtimeConfig: {
|
|
// Variables privadas del servidor (no expuestas al cliente)
|
|
printerHost: process.env.PRINTER_HOST || '192.168.87.147',
|
|
printerDeviceId: process.env.PRINTER_DEVICE_ID || 'matricial2',
|
|
printerTimeoutMs: process.env.PRINTER_TIMEOUT_MS || '60000',
|
|
|
|
public: {
|
|
// Variables públicas (expuestas al cliente)
|
|
authentikUrl: process.env.NUXT_PUBLIC_AUTHENTIK_URL || 'https://authentik.nucleoriofrio.com',
|
|
authEnabled: process.env.NUXT_PUBLIC_AUTH_ENABLED === 'true'
|
|
}
|
|
},
|
|
|
|
pwa: {
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.ico', 'icon.png', 'icons/*.png'],
|
|
manifest: {
|
|
name: 'Printer Central',
|
|
short_name: 'Printer',
|
|
description: 'Administra tus impresoras de forma facil y rapida.',
|
|
theme_color: '#3f75d2',
|
|
background_color: '#ffffff',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
scope: '/',
|
|
start_url: '/',
|
|
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',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: '/icons/icon-384.png',
|
|
sizes: '384x384',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: '/icons/icon-512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'any maskable'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
navigateFallback: '/',
|
|
navigateFallbackDenylist: [/^\/api\//],
|
|
globPatterns: ['**/*.{js,css,html,png,svg,ico,json,jpeg}'],
|
|
cleanupOutdatedCaches: true,
|
|
runtimeCaching: [
|
|
{
|
|
// API calls siempre van a la red
|
|
urlPattern: ({ url }) => url.pathname.startsWith('/api/'),
|
|
handler: 'NetworkOnly'
|
|
},
|
|
{
|
|
// Páginas con NetworkFirst
|
|
urlPattern: ({ url, request }) => {
|
|
return request.destination === 'document' ||
|
|
request.mode === 'navigate' ||
|
|
url.pathname === '/'
|
|
},
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'pages-cache',
|
|
networkTimeoutSeconds: 3,
|
|
expiration: {
|
|
maxEntries: 50,
|
|
maxAgeSeconds: 60 * 60 * 24 * 7 // 7 días
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
// Assets estáticos con CacheFirst
|
|
urlPattern: ({ url, request }) => {
|
|
return request.destination === 'image' ||
|
|
request.destination === 'style' ||
|
|
request.destination === 'script'
|
|
},
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'assets-cache',
|
|
expiration: {
|
|
maxEntries: 100,
|
|
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 días
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
devOptions: {
|
|
enabled: true,
|
|
type: 'module'
|
|
}
|
|
}
|
|
})
|