mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 09:28:39 -06:00
fix: adjusts in proxy
This commit is contained in:
parent
d75163aa57
commit
2de0b61726
@ -11,6 +11,7 @@ import { RepositoryBroker } from '../repository/repository.manager';
|
|||||||
import { AuthService, OldToken } from '../services/auth.service';
|
import { AuthService, OldToken } from '../services/auth.service';
|
||||||
import { ChatwootService } from '../services/chatwoot.service';
|
import { ChatwootService } from '../services/chatwoot.service';
|
||||||
import { WAMonitoringService } from '../services/monitor.service';
|
import { WAMonitoringService } from '../services/monitor.service';
|
||||||
|
import { ProxyService } from '../services/proxy.service';
|
||||||
import { RabbitmqService } from '../services/rabbitmq.service';
|
import { RabbitmqService } from '../services/rabbitmq.service';
|
||||||
import { SettingsService } from '../services/settings.service';
|
import { SettingsService } from '../services/settings.service';
|
||||||
import { SqsService } from '../services/sqs.service';
|
import { SqsService } from '../services/sqs.service';
|
||||||
@ -32,6 +33,7 @@ export class InstanceController {
|
|||||||
private readonly settingsService: SettingsService,
|
private readonly settingsService: SettingsService,
|
||||||
private readonly websocketService: WebsocketService,
|
private readonly websocketService: WebsocketService,
|
||||||
private readonly rabbitmqService: RabbitmqService,
|
private readonly rabbitmqService: RabbitmqService,
|
||||||
|
private readonly proxyService: ProxyService,
|
||||||
private readonly sqsService: SqsService,
|
private readonly sqsService: SqsService,
|
||||||
private readonly typebotService: TypebotService,
|
private readonly typebotService: TypebotService,
|
||||||
private readonly cache: RedisCache,
|
private readonly cache: RedisCache,
|
||||||
@ -73,6 +75,7 @@ export class InstanceController {
|
|||||||
typebot_delay_message,
|
typebot_delay_message,
|
||||||
typebot_unknown_message,
|
typebot_unknown_message,
|
||||||
typebot_listening_from_me,
|
typebot_listening_from_me,
|
||||||
|
proxy,
|
||||||
}: InstanceDto) {
|
}: InstanceDto) {
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('requested createInstance from ' + instanceName + ' instance');
|
this.logger.verbose('requested createInstance from ' + instanceName + ' instance');
|
||||||
@ -247,6 +250,18 @@ export class InstanceController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proxy) {
|
||||||
|
this.logger.verbose('creating proxy');
|
||||||
|
try {
|
||||||
|
this.proxyService.create(instance, {
|
||||||
|
enabled: true,
|
||||||
|
proxy,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let sqsEvents: string[];
|
let sqsEvents: string[];
|
||||||
|
|
||||||
if (sqs_enabled) {
|
if (sqs_enabled) {
|
||||||
@ -377,6 +392,7 @@ export class InstanceController {
|
|||||||
},
|
},
|
||||||
settings,
|
settings,
|
||||||
qrcode: getQrcode,
|
qrcode: getQrcode,
|
||||||
|
proxy,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.logger.verbose('instance created');
|
this.logger.verbose('instance created');
|
||||||
@ -486,6 +502,7 @@ export class InstanceController {
|
|||||||
name_inbox: instance.instanceName,
|
name_inbox: instance.instanceName,
|
||||||
webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
webhook_url: `${urlServer}/chatwoot/webhook/${encodeURIComponent(instance.instanceName)}`,
|
||||||
},
|
},
|
||||||
|
proxy,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error.message[0]);
|
this.logger.error(error.message[0]);
|
||||||
|
@ -32,6 +32,5 @@ export class InstanceDto {
|
|||||||
typebot_delay_message?: number;
|
typebot_delay_message?: number;
|
||||||
typebot_unknown_message?: string;
|
typebot_unknown_message?: string;
|
||||||
typebot_listening_from_me?: boolean;
|
typebot_listening_from_me?: boolean;
|
||||||
proxy_enabled?: boolean;
|
proxy?: string;
|
||||||
proxy_proxy?: string;
|
|
||||||
}
|
}
|
||||||
|
@ -1297,7 +1297,7 @@ export class WAStartupService {
|
|||||||
let options;
|
let options;
|
||||||
|
|
||||||
if (this.localProxy.enabled) {
|
if (this.localProxy.enabled) {
|
||||||
this.logger.verbose('Proxy enabled');
|
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
|
||||||
|
|
||||||
if (this.localProxy.proxy.includes('proxyscrape')) {
|
if (this.localProxy.proxy.includes('proxyscrape')) {
|
||||||
const response = await axios.get(this.localProxy.proxy);
|
const response = await axios.get(this.localProxy.proxy);
|
||||||
|
Loading…
Reference in New Issue
Block a user