diff --git a/CHANGELOG.md b/CHANGELOG.md index c8bf1cedd..fc11ef67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.7.4 (develop) + +### Fixed +* Adjusts in proxy on fetchAgent +* Recovering messages lost with redis cache +* Log when init redis cache service + # 1.7.3 (2024-04-18 12:07) ### Fixed diff --git a/src/api/models/message.model.ts b/src/api/models/message.model.ts index 893d1f2af..95cb55133 100644 --- a/src/api/models/message.model.ts +++ b/src/api/models/message.model.ts @@ -32,6 +32,7 @@ export class MessageRaw { source_reply_id?: string; chatwoot?: ChatwootMessage; contextInfo?: any; + status?: wa.StatusMessage | any; } type MessageRawBoolean = { diff --git a/src/api/services/whatsapp/whatsapp.baileys.service.ts b/src/api/services/whatsapp/whatsapp.baileys.service.ts index 732f82a08..d8d856a16 100644 --- a/src/api/services/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/services/whatsapp/whatsapp.baileys.service.ts @@ -151,7 +151,7 @@ export class BaileysStartupService extends WAStartupService { const cacheConf = this.configService.get('CACHE'); if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) { - setTimeout(async () => { + setInterval(async () => { this.logger.info('Recovering messages'); this.messagesLostCache.keys().then((keys) => { keys.forEach(async (key) => { @@ -517,6 +517,7 @@ export class BaileysStartupService extends WAStartupService { const proxyUrl = 'http://' + proxyUrls[rand]; options = { agent: makeProxyAgent(proxyUrl), + fetchAgent: makeProxyAgent(proxyUrl), }; } catch (error) { this.localProxy.enabled = false; @@ -524,6 +525,7 @@ export class BaileysStartupService extends WAStartupService { } else { options = { agent: makeProxyAgent(this.localProxy.proxy), + fetchAgent: makeProxyAgent(this.localProxy.proxy), }; } } @@ -687,6 +689,7 @@ export class BaileysStartupService extends WAStartupService { const proxyUrl = 'http://' + proxyUrls[rand]; options = { agent: makeProxyAgent(proxyUrl), + fetchAgent: makeProxyAgent(proxyUrl), }; } catch (error) { this.localProxy.enabled = false; @@ -694,6 +697,7 @@ export class BaileysStartupService extends WAStartupService { } else { options = { agent: makeProxyAgent(this.localProxy.proxy), + fetchAgent: makeProxyAgent(this.localProxy.proxy), }; } } @@ -997,6 +1001,15 @@ export class BaileysStartupService extends WAStartupService { continue; } + const status: Record = { + 0: 'ERROR', + 1: 'PENDING', + 2: 'SERVER_ACK', + 3: 'DELIVERY_ACK', + 4: 'READ', + 5: 'PLAYED', + }; + messagesRaw.push({ key: m.key, pushName: m.pushName || m.key.remoteJid.split('@')[0], @@ -1005,6 +1018,7 @@ export class BaileysStartupService extends WAStartupService { messageType: getContentType(m.message), messageTimestamp: m.messageTimestamp as number, owner: this.instance.name, + status: m.status ? status[m.status] : null, }); } diff --git a/src/cache/cacheengine.ts b/src/cache/cacheengine.ts index 258a98c2b..dd3d18f18 100644 --- a/src/cache/cacheengine.ts +++ b/src/cache/cacheengine.ts @@ -1,8 +1,11 @@ import { ICache } from '../api/abstract/abstract.cache'; import { CacheConf, ConfigService } from '../config/env.config'; +import { Logger } from '../config/logger.config'; import { LocalCache } from './localcache'; import { RedisCache } from './rediscache'; +const logger = new Logger('Redis'); + export class CacheEngine { private engine: ICache; @@ -14,6 +17,8 @@ export class CacheEngine { } else if (cacheConf?.LOCAL?.ENABLED) { this.engine = new LocalCache(configService, module); } + + logger.info(`RedisCache initialized for ${module}`); } public getEngine() { diff --git a/views/manager-wip.hbs b/views/manager-wip.hbs deleted file mode 100644 index 59b0cd0f8..000000000 --- a/views/manager-wip.hbs +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - Instance Manager - - - -
- - - - - - - - - - - - - - - - {{#each instances}} - - - - - - - {{/each}} - -
Nome da InstânciaStatusAPI KeyAções
{{this.instance.instanceName}}{{this.instance.status}}{{this.instance.apikey}} - - -
-
- - - - - - - - - - - - \ No newline at end of file