mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
feat(router): update whatsappWebVersion to fetch latest Baileys version
- Modified the root route to fetch the latest WhatsApp web version from Baileys if not set in the environment configuration. - This enhancement ensures that clients receive the most up-to-date version information in the API response.
This commit is contained in:
parent
afc2927837
commit
62c00c3db2
@ -6,6 +6,7 @@ import { ChatbotRouter } from '@api/integrations/chatbot/chatbot.router';
|
||||
import { EventRouter } from '@api/integrations/event/event.router';
|
||||
import { StorageRouter } from '@api/integrations/storage/storage.router';
|
||||
import { configService } from '@config/env.config';
|
||||
import { fetchLatestBaileysVersion } from 'baileys';
|
||||
import { Router } from 'express';
|
||||
import fs from 'fs';
|
||||
import mimeTypes from 'mime-types';
|
||||
@ -60,7 +61,7 @@ router.get('/assets/*', (req, res) => {
|
||||
router
|
||||
.use((req, res, next) => telemetry.collectTelemetry(req, res, next))
|
||||
|
||||
.get('/', (req, res) => {
|
||||
.get('/', async (req, res) => {
|
||||
res.status(HttpStatus.OK).json({
|
||||
status: HttpStatus.OK,
|
||||
message: 'Welcome to the Evolution API, it is working!',
|
||||
@ -68,7 +69,8 @@ router
|
||||
clientName: process.env.DATABASE_CONNECTION_CLIENT_NAME,
|
||||
manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined,
|
||||
documentation: `https://doc.evolution-api.com`,
|
||||
whatsappWebVersion: process.env.CONFIG_SESSION_PHONE_VERSION,
|
||||
whatsappWebVersion:
|
||||
process.env.CONFIG_SESSION_PHONE_VERSION || (await fetchLatestBaileysVersion()).version.join('.'),
|
||||
});
|
||||
})
|
||||
.post('/verify-creds', authGuard['apikey'], async (req, res) => {
|
||||
|
Loading…
Reference in New Issue
Block a user