mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 18:08:40 -06:00
Merge branch 'release/2.3.9'
This commit is contained in:
commit
e071f56767
@ -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)
|
# 1.7.3 (2024-04-18 12:07)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -32,6 +32,7 @@ export class MessageRaw {
|
|||||||
source_reply_id?: string;
|
source_reply_id?: string;
|
||||||
chatwoot?: ChatwootMessage;
|
chatwoot?: ChatwootMessage;
|
||||||
contextInfo?: any;
|
contextInfo?: any;
|
||||||
|
status?: wa.StatusMessage | any;
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageRawBoolean<T> = {
|
type MessageRawBoolean<T> = {
|
||||||
|
@ -151,7 +151,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
const cacheConf = this.configService.get<CacheConf>('CACHE');
|
const cacheConf = this.configService.get<CacheConf>('CACHE');
|
||||||
|
|
||||||
if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) {
|
if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) {
|
||||||
setTimeout(async () => {
|
setInterval(async () => {
|
||||||
this.logger.info('Recovering messages');
|
this.logger.info('Recovering messages');
|
||||||
this.messagesLostCache.keys().then((keys) => {
|
this.messagesLostCache.keys().then((keys) => {
|
||||||
keys.forEach(async (key) => {
|
keys.forEach(async (key) => {
|
||||||
@ -517,6 +517,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
const proxyUrl = 'http://' + proxyUrls[rand];
|
const proxyUrl = 'http://' + proxyUrls[rand];
|
||||||
options = {
|
options = {
|
||||||
agent: makeProxyAgent(proxyUrl),
|
agent: makeProxyAgent(proxyUrl),
|
||||||
|
fetchAgent: makeProxyAgent(proxyUrl),
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.localProxy.enabled = false;
|
this.localProxy.enabled = false;
|
||||||
@ -524,6 +525,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
} else {
|
} else {
|
||||||
options = {
|
options = {
|
||||||
agent: makeProxyAgent(this.localProxy.proxy),
|
agent: makeProxyAgent(this.localProxy.proxy),
|
||||||
|
fetchAgent: makeProxyAgent(this.localProxy.proxy),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,6 +689,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
const proxyUrl = 'http://' + proxyUrls[rand];
|
const proxyUrl = 'http://' + proxyUrls[rand];
|
||||||
options = {
|
options = {
|
||||||
agent: makeProxyAgent(proxyUrl),
|
agent: makeProxyAgent(proxyUrl),
|
||||||
|
fetchAgent: makeProxyAgent(proxyUrl),
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.localProxy.enabled = false;
|
this.localProxy.enabled = false;
|
||||||
@ -694,6 +697,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
} else {
|
} else {
|
||||||
options = {
|
options = {
|
||||||
agent: makeProxyAgent(this.localProxy.proxy),
|
agent: makeProxyAgent(this.localProxy.proxy),
|
||||||
|
fetchAgent: makeProxyAgent(this.localProxy.proxy),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -997,6 +1001,15 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const status: Record<number, wa.StatusMessage> = {
|
||||||
|
0: 'ERROR',
|
||||||
|
1: 'PENDING',
|
||||||
|
2: 'SERVER_ACK',
|
||||||
|
3: 'DELIVERY_ACK',
|
||||||
|
4: 'READ',
|
||||||
|
5: 'PLAYED',
|
||||||
|
};
|
||||||
|
|
||||||
messagesRaw.push({
|
messagesRaw.push({
|
||||||
key: m.key,
|
key: m.key,
|
||||||
pushName: m.pushName || m.key.remoteJid.split('@')[0],
|
pushName: m.pushName || m.key.remoteJid.split('@')[0],
|
||||||
@ -1005,6 +1018,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
messageType: getContentType(m.message),
|
messageType: getContentType(m.message),
|
||||||
messageTimestamp: m.messageTimestamp as number,
|
messageTimestamp: m.messageTimestamp as number,
|
||||||
owner: this.instance.name,
|
owner: this.instance.name,
|
||||||
|
status: m.status ? status[m.status] : null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
src/cache/cacheengine.ts
vendored
5
src/cache/cacheengine.ts
vendored
@ -1,8 +1,11 @@
|
|||||||
import { ICache } from '../api/abstract/abstract.cache';
|
import { ICache } from '../api/abstract/abstract.cache';
|
||||||
import { CacheConf, ConfigService } from '../config/env.config';
|
import { CacheConf, ConfigService } from '../config/env.config';
|
||||||
|
import { Logger } from '../config/logger.config';
|
||||||
import { LocalCache } from './localcache';
|
import { LocalCache } from './localcache';
|
||||||
import { RedisCache } from './rediscache';
|
import { RedisCache } from './rediscache';
|
||||||
|
|
||||||
|
const logger = new Logger('Redis');
|
||||||
|
|
||||||
export class CacheEngine {
|
export class CacheEngine {
|
||||||
private engine: ICache;
|
private engine: ICache;
|
||||||
|
|
||||||
@ -14,6 +17,8 @@ export class CacheEngine {
|
|||||||
} else if (cacheConf?.LOCAL?.ENABLED) {
|
} else if (cacheConf?.LOCAL?.ENABLED) {
|
||||||
this.engine = new LocalCache(configService, module);
|
this.engine = new LocalCache(configService, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(`RedisCache initialized for ${module}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEngine() {
|
public getEngine() {
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="pt-br">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="shortcut icon" href="https://evolution-api.com/files/evolution-api-favicon.png" type="image/x-icon">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
|
|
||||||
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
|
|
||||||
<title>Instance Manager</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="container mt-4">
|
|
||||||
<!-- Botão para abrir o modal de adicionar nova instância -->
|
|
||||||
<button class="btn btn-primary mb-3" data-toggle="modal" data-target="#actionModal" data-action="add">Nova
|
|
||||||
Instância</button>
|
|
||||||
|
|
||||||
<!-- Tabela de instâncias -->
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Nome da Instância</th>
|
|
||||||
<th>Status</th>
|
|
||||||
<th>API Key</th>
|
|
||||||
<th>Ações</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<!-- Iterando sobre as instâncias e preenchendo a tabela -->
|
|
||||||
{{#each instances}}
|
|
||||||
<tr>
|
|
||||||
<td>{{this.instance.instanceName}}</td>
|
|
||||||
<td>{{this.instance.status}}</td>
|
|
||||||
<td>{{this.instance.apikey}}</td>
|
|
||||||
<td>
|
|
||||||
<!-- Dropdown de ações para cada instância -->
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="actionDropdown"
|
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
Ações
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="actionDropdown">
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#actionModal"
|
|
||||||
data-action="connect">Connect</a>
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#actionModal"
|
|
||||||
data-action="restart">Restart</a>
|
|
||||||
<!-- Adicione mais itens de ação aqui -->
|
|
||||||
<!-- ... -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/each}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Modal de ações -->
|
|
||||||
<div class="modal fade" id="actionModal" tabindex="-1" role="dialog" aria-labelledby="actionModalLabel"
|
|
||||||
aria-hidden="true">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title" id="actionModalLabel">Ação</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
|
|
||||||
<button type="button" class="btn btn-primary">Salvar</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
|
|
||||||
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
|
|
||||||
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"
|
|
||||||
integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('#actionModal').on('show.bs.modal', function(event) {
|
|
||||||
var button = $(event.relatedTarget);
|
|
||||||
var action = button.data('action');
|
|
||||||
|
|
||||||
console.log(action);
|
|
||||||
|
|
||||||
if (action === 'connect') {
|
|
||||||
|
|
||||||
} else if (action === 'restart') {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user