feat: WhatsApp Nucleo con Nuxt 4 + Baileys v7
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 6m46s

Reemplazo completo de Evolution API por implementación directa con Baileys.

Características:
- Dashboard completo con Nuxt UI v4
- Soporte para múltiples instancias de WhatsApp
- Conexión via QR code o pairing code
- Persistencia de mensajes en PostgreSQL
- API REST para integraciones externas
- Webhooks con firma HMAC
- SSE para actualizaciones en tiempo real
- Autenticación con Authentik
This commit is contained in:
2025-12-02 17:54:31 -06:00
parent 327118440b
commit faedec47d7
62 changed files with 4489 additions and 92 deletions

View File

@@ -0,0 +1,41 @@
/**
* DELETE /api/instances/:id
* Delete an instance
*/
import { query } from '../../../utils/database'
import { baileysManager } from '../../../services/baileys/manager'
import { clearAuthState } from '../../../services/baileys/auth-state'
export default defineEventHandler(async (event) => {
const username = getHeader(event, 'x-authentik-username')
if (!username) {
throw createError({ statusCode: 401, message: 'Unauthorized' })
}
const id = getRouterParam(event, 'id')
// Check if instance exists
const result = await query<{ id: string }>(
'SELECT id FROM instances WHERE id = $1',
[id]
)
if (result.rows.length === 0) {
throw createError({ statusCode: 404, message: 'Instance not found' })
}
// Disconnect if connected
try {
await baileysManager.disconnect(id!)
} catch (error) {
// Ignore disconnect errors
}
// Clear auth state
await clearAuthState(id!)
// Delete from database (cascades to related tables)
await query('DELETE FROM instances WHERE id = $1', [id])
return { success: true }
})