mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -06:00
Merge branch 'release/1.7.0'
This commit is contained in:
commit
b87558d301
@ -472,7 +472,7 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
if (this.localProxy.enabled) {
|
if (this.localProxy.enabled) {
|
||||||
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
|
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
|
||||||
|
|
||||||
if (this.localProxy.proxy.host.includes('proxyscrape')) {
|
if (this.localProxy?.proxy?.host?.includes('proxyscrape')) {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(this.localProxy.proxy.host);
|
const response = await axios.get(this.localProxy.proxy.host);
|
||||||
const text = response.data;
|
const text = response.data;
|
||||||
|
@ -663,6 +663,18 @@ export class WAStartupService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private assertExchangeAsync = (channel, exchangeName, exchangeType, options) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
channel.assertExchange(exchangeName, exchangeType, options, (error, ok) => {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
resolve(ok);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {
|
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {
|
||||||
const webhookGlobal = this.configService.get<Webhook>('WEBHOOK');
|
const webhookGlobal = this.configService.get<Webhook>('WEBHOOK');
|
||||||
const webhookLocal = this.localWebhook.events;
|
const webhookLocal = this.localWebhook.events;
|
||||||
@ -687,14 +699,19 @@ export class WAStartupService {
|
|||||||
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
|
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
|
||||||
const exchangeName = this.instanceName ?? 'evolution_exchange';
|
const exchangeName = this.instanceName ?? 'evolution_exchange';
|
||||||
|
|
||||||
amqp.assertExchange(exchangeName, 'topic', {
|
// await amqp.assertExchange(exchangeName, 'topic', {
|
||||||
|
// durable: true,
|
||||||
|
// autoDelete: false,
|
||||||
|
// });
|
||||||
|
|
||||||
|
await this.assertExchangeAsync(amqp, exchangeName, 'topic', {
|
||||||
durable: true,
|
durable: true,
|
||||||
autoDelete: false,
|
autoDelete: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const queueName = `${this.instanceName}.${event}`;
|
const queueName = `${this.instanceName}.${event}`;
|
||||||
|
|
||||||
amqp.assertQueue(queueName, {
|
await amqp.assertQueue(queueName, {
|
||||||
durable: true,
|
durable: true,
|
||||||
autoDelete: false,
|
autoDelete: false,
|
||||||
arguments: {
|
arguments: {
|
||||||
@ -702,7 +719,7 @@ export class WAStartupService {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
amqp.bindQueue(queueName, exchangeName, event);
|
await amqp.bindQueue(queueName, exchangeName, event);
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
event,
|
event,
|
||||||
@ -717,7 +734,7 @@ export class WAStartupService {
|
|||||||
message['apikey'] = instanceApikey;
|
message['apikey'] = instanceApikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
amqp.publish(exchangeName, event, Buffer.from(JSON.stringify(message)));
|
await amqp.publish(exchangeName, event, Buffer.from(JSON.stringify(message)));
|
||||||
|
|
||||||
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
if (this.configService.get<Log>('LOG').LEVEL.includes('WEBHOOKS')) {
|
||||||
const logData = {
|
const logData = {
|
||||||
|
Loading…
Reference in New Issue
Block a user