All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 4m20s
Configura headers CORS en nuxt.config.ts para permitir llamadas desde otros orígenes a: - /api/messages/send - /api/mcp Esto permite que aplicaciones externas como el sistema de asistencia puedan enviar mensajes de WhatsApp.
122 lines
3.3 KiB
TypeScript
122 lines
3.3 KiB
TypeScript
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
export default defineNuxtConfig({
|
|
srcDir: 'app',
|
|
serverDir: 'server',
|
|
ssr: true,
|
|
devtools: { enabled: true },
|
|
css: ['~/assets/css/main.css'],
|
|
modules: ['@nuxt/image', '@nuxt/ui', '@vite-pwa/nuxt'],
|
|
|
|
// Performance optimizations
|
|
experimental: {
|
|
payloadExtraction: false
|
|
},
|
|
|
|
// Vite config
|
|
vite: {
|
|
server: {
|
|
hmr: {
|
|
clientPort: 443,
|
|
protocol: 'wss'
|
|
},
|
|
allowedHosts: [
|
|
'.nucleoriofrio.com',
|
|
'whatsapp.nucleoriofrio.com'
|
|
]
|
|
}
|
|
},
|
|
|
|
app: {
|
|
head: {
|
|
title: 'WhatsApp Nucleo',
|
|
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: '#075e54' },
|
|
{ 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: {
|
|
experimental: {
|
|
openAPI: true
|
|
},
|
|
routeRules: {
|
|
// CORS para API externa
|
|
'/api/messages/send': {
|
|
cors: true,
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization'
|
|
}
|
|
},
|
|
'/api/mcp': {
|
|
cors: true,
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization'
|
|
}
|
|
},
|
|
'/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'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
pwa: {
|
|
registerType: 'autoUpdate',
|
|
strategies: 'generateSW',
|
|
manifestFilename: 'manifest.webmanifest',
|
|
manifest: {
|
|
id: '/?app=whatsapp',
|
|
name: 'WhatsApp Nucleo',
|
|
short_name: 'WhatsApp',
|
|
description: 'Gestiona multiples instancias de WhatsApp desde un panel centralizado',
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'standalone',
|
|
background_color: '#075e54',
|
|
theme_color: '#075e54',
|
|
icons: [
|
|
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
|
|
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' }
|
|
]
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,png,svg,webp,ico,json,woff2}'],
|
|
navigateFallback: undefined,
|
|
cleanupOutdatedCaches: true
|
|
},
|
|
devOptions: {
|
|
enabled: false
|
|
}
|
|
},
|
|
|
|
runtimeConfig: {
|
|
// Server-side only
|
|
databaseUrl: process.env.DATABASE_URL || 'postgresql://whatsapp:password@localhost:5432/whatsapp',
|
|
masterApiKey: process.env.MASTER_API_KEY || '',
|
|
// Public (client + server)
|
|
public: {
|
|
authentikUrl: process.env.NUXT_PUBLIC_AUTHENTIK_URL || 'https://authentik.nucleoriofrio.com'
|
|
}
|
|
}
|
|
})
|