All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m16s
- Agregar id único (/?app=inicio) para identificar PWA - Implementar launch_handler con navigate-existing para mantener una sola ventana - Mejoras basadas en especificaciones actualizadas de Chrome for Developers
149 lines
4.1 KiB
TypeScript
149 lines
4.1 KiB
TypeScript
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
export default defineNuxtConfig({
|
|
compatibilityDate: '2025-07-15',
|
|
devtools: { enabled: true },
|
|
|
|
modules: [
|
|
'@nuxt/ui',
|
|
'@nuxt/test-utils',
|
|
'@nuxt/image',
|
|
'@nuxt/eslint',
|
|
'@nuxt/content',
|
|
'@vite-pwa/nuxt'
|
|
],
|
|
|
|
css: ['~/assets/css/main.css'],
|
|
|
|
runtimeConfig: {
|
|
// Variables privadas del servidor (no expuestas al cliente)
|
|
authentikApiToken: process.env.NUXT_AUTHENTIK_API_TOKEN || '',
|
|
authentikApiUrl: process.env.NUXT_AUTHENTIK_API_URL || 'https://authentik.nucleoriofrio.com',
|
|
|
|
// Variables públicas (expuestas al cliente)
|
|
public: {
|
|
authentikUrl: process.env.NUXT_PUBLIC_AUTHENTIK_URL || 'https://authentik.nucleoriofrio.com'
|
|
}
|
|
},
|
|
|
|
pwa: {
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'icon.svg', 'offline.html'],
|
|
manifest: {
|
|
id: '/?app=inicio',
|
|
name: 'Perfil Nucleo',
|
|
short_name: 'Perfil',
|
|
description: 'Gestiona tu perfil de usuario y accede a tus aplicaciones de Nucleo',
|
|
lang: 'es',
|
|
dir: 'ltr',
|
|
theme_color: '#00DC82',
|
|
background_color: '#ffffff',
|
|
display: 'standalone',
|
|
display_override: ['window-controls-overlay', 'standalone'],
|
|
orientation: 'any',
|
|
scope: '/',
|
|
start_url: '/?source=pwa',
|
|
// Control de ventanas - mantener una sola ventana al navegar
|
|
launch_handler: {
|
|
client_mode: 'navigate-existing'
|
|
},
|
|
// Capturar todos los enlaces que apunten a esta app
|
|
capture_links: 'existing-client-navigate',
|
|
// Extender scope a otros subdominios de Nucleo V3
|
|
scope_extensions: [
|
|
{
|
|
origin: "https://musica.nucleoriofrio.com"
|
|
},
|
|
{
|
|
origin: "https://docs.nucleoriofrio.com"
|
|
},
|
|
{
|
|
origin: "https://analitica.nucleoriofrio.com"
|
|
},
|
|
{
|
|
origin: "https://seguidordelotes.nucleoriofrio.com"
|
|
},
|
|
{
|
|
origin: "https://whisper.nucleoriofrio.com"
|
|
},
|
|
{
|
|
origin: "https://amigos.nucleoriofrio.com"
|
|
}
|
|
],
|
|
icons: [
|
|
{
|
|
src: '/icon-192x192.png',
|
|
sizes: '500x192',
|
|
type: 'image/png',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: '/icon-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: '/icon-512x512-maskable.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'maskable'
|
|
}
|
|
],
|
|
screenshots: [
|
|
{
|
|
src: '/screenshots/desktop-1.png',
|
|
sizes: '1920x1080',
|
|
type: 'image/png',
|
|
form_factor: 'wide',
|
|
label: 'Pantalla principal en escritorio'
|
|
},
|
|
{
|
|
src: '/screenshots/mobile-1.png',
|
|
sizes: '614x853',
|
|
type: 'image/png',
|
|
form_factor: 'narrow',
|
|
label: 'Pantalla principal en móvil'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
navigateFallback: '/offline.html',
|
|
navigateFallbackDenylist: [/^\/api\//, /^\/authentik\//],
|
|
globPatterns: ['**/*.{js,css,html,png,svg,ico,json}'],
|
|
cleanupOutdatedCaches: true,
|
|
// Capturar todas las navegaciones dentro del scope
|
|
navigateFallbackAllowlist: [/^\//],
|
|
clientsClaim: true,
|
|
skipWaiting: true,
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/authentik\.nucleoriofrio\.com\/.*/i,
|
|
handler: 'NetworkOnly'
|
|
},
|
|
{
|
|
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 days
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
devOptions: {
|
|
enabled: true,
|
|
type: 'module'
|
|
}
|
|
}
|
|
}) |