mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
prisma orm: all endpoints ok
This commit is contained in:
@@ -240,8 +240,20 @@ export class ChannelStartupService {
|
||||
|
||||
public async setSettings(data: SettingsDto) {
|
||||
this.logger.verbose('Setting settings');
|
||||
await this.prismaRepository.setting.create({
|
||||
data: {
|
||||
await this.prismaRepository.setting.upsert({
|
||||
where: {
|
||||
instanceId: this.instanceId,
|
||||
},
|
||||
update: {
|
||||
rejectCall: data.rejectCall,
|
||||
msgCall: data.msgCall,
|
||||
groupsIgnore: data.groupsIgnore,
|
||||
alwaysOnline: data.alwaysOnline,
|
||||
readMessages: data.readMessages,
|
||||
readStatus: data.readStatus,
|
||||
syncFullHistory: data.syncFullHistory,
|
||||
},
|
||||
create: {
|
||||
rejectCall: data.rejectCall,
|
||||
msgCall: data.msgCall,
|
||||
groupsIgnore: data.groupsIgnore,
|
||||
@@ -805,15 +817,20 @@ export class ChannelStartupService {
|
||||
this.localProxy.enabled = data?.enabled;
|
||||
this.logger.verbose(`Proxy enabled: ${this.localProxy.enabled}`);
|
||||
|
||||
this.localProxy.proxy = {
|
||||
host: data?.host,
|
||||
port: `${data?.port}`,
|
||||
protocol: data?.protocol,
|
||||
username: data?.username,
|
||||
password: data?.password,
|
||||
};
|
||||
this.localProxy.host = data?.host;
|
||||
this.logger.verbose(`Proxy host: ${this.localProxy.host}`);
|
||||
|
||||
this.logger.verbose(`Proxy proxy: ${this.localProxy.proxy?.host}`);
|
||||
this.localProxy.port = data?.port;
|
||||
this.logger.verbose(`Proxy port: ${this.localProxy.port}`);
|
||||
|
||||
this.localProxy.protocol = data?.protocol;
|
||||
this.logger.verbose(`Proxy protocol: ${this.localProxy.protocol}`);
|
||||
|
||||
this.localProxy.username = data?.username;
|
||||
this.logger.verbose(`Proxy username: ${this.localProxy.username}`);
|
||||
|
||||
this.localProxy.password = data?.password;
|
||||
this.logger.verbose(`Proxy password: ${this.localProxy.password}`);
|
||||
|
||||
this.logger.verbose('Proxy loaded');
|
||||
}
|
||||
|
||||
@@ -553,11 +553,11 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
let options;
|
||||
|
||||
if (this.localProxy.enabled) {
|
||||
this.logger.info('Proxy enabled: ' + this.localProxy.proxy?.host);
|
||||
this.logger.info('Proxy enabled: ' + this.localProxy?.host);
|
||||
|
||||
if (this.localProxy?.proxy?.host?.includes('proxyscrape')) {
|
||||
if (this.localProxy?.host?.includes('proxyscrape')) {
|
||||
try {
|
||||
const response = await axios.get(this.localProxy.proxy?.host);
|
||||
const response = await axios.get(this.localProxy?.host);
|
||||
const text = response.data;
|
||||
const proxyUrls = text.split('\r\n');
|
||||
const rand = Math.floor(Math.random() * Math.floor(proxyUrls.length));
|
||||
@@ -571,8 +571,20 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
} else {
|
||||
options = {
|
||||
agent: makeProxyAgent(this.localProxy.proxy),
|
||||
fetchAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
agent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
fetchAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -673,11 +685,11 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
let options;
|
||||
|
||||
if (this.localProxy.enabled) {
|
||||
this.logger.info('Proxy enabled: ' + this.localProxy.proxy?.host);
|
||||
this.logger.info('Proxy enabled: ' + this.localProxy?.host);
|
||||
|
||||
if (this.localProxy?.proxy?.host?.includes('proxyscrape')) {
|
||||
if (this.localProxy?.host?.includes('proxyscrape')) {
|
||||
try {
|
||||
const response = await axios.get(this.localProxy.proxy?.host);
|
||||
const response = await axios.get(this.localProxy?.host);
|
||||
const text = response.data;
|
||||
const proxyUrls = text.split('\r\n');
|
||||
const rand = Math.floor(Math.random() * Math.floor(proxyUrls.length));
|
||||
@@ -691,8 +703,20 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
} else {
|
||||
options = {
|
||||
agent: makeProxyAgent(this.localProxy.proxy),
|
||||
fetchAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
agent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
fetchAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2317,7 +2341,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (this.localProxy.enabled) {
|
||||
config = {
|
||||
...config,
|
||||
httpsAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
httpsAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2388,7 +2418,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (this.localProxy.enabled) {
|
||||
config = {
|
||||
...config,
|
||||
httpsAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
httpsAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3105,7 +3141,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (this.localProxy.enabled) {
|
||||
config = {
|
||||
...config,
|
||||
httpsAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
httpsAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3307,7 +3349,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (this.localProxy.enabled) {
|
||||
config = {
|
||||
...config,
|
||||
httpsAgent: makeProxyAgent(this.localProxy.proxy),
|
||||
httpsAgent: makeProxyAgent({
|
||||
host: this.localProxy.host,
|
||||
port: this.localProxy.port,
|
||||
protocol: this.localProxy.protocol,
|
||||
username: this.localProxy.username,
|
||||
password: this.localProxy.password,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user