Merge pull request #17 from EvolutionAPI/v2.0.0

V2.0.0
This commit is contained in:
Judson Junior
2024-08-30 10:32:44 -03:00
committed by GitHub
3 changed files with 35 additions and 6 deletions

View File

@@ -21,6 +21,9 @@ export class CacheService {
}
public async hGet(key: string, field: string) {
if (!this.cache) {
return null;
}
try {
const data = await this.cache.hGet(key, field);
@@ -43,6 +46,9 @@ export class CacheService {
}
public async hSet(key: string, field: string, value: any) {
if (!this.cache) {
return;
}
try {
const json = JSON.stringify(value, BufferJSON.replacer);
@@ -67,6 +73,9 @@ export class CacheService {
}
async hDelete(key: string, field: string) {
if (!this.cache) {
return false;
}
try {
await this.cache.hDelete(key, field);
return true;

View File

@@ -338,18 +338,31 @@ export class ChannelStartupService {
}
public async loadProxy() {
this.localProxy.enabled = false;
if (process.env.PROXY_HOST) {
this.localProxy.enabled = true;
this.localProxy.host = process.env.PROXY_HOST;
this.localProxy.port = process.env.PROXY_PORT || '80';
this.localProxy.protocol = process.env.PROXY_PROTOCOL || 'http';
this.localProxy.username = process.env.PROXY_USERNAME;
this.localProxy.password = process.env.PROXY_PASSWORD;
}
const data = await this.prismaRepository.proxy.findUnique({
where: {
instanceId: this.instanceId,
},
});
this.localProxy.enabled = data?.enabled;
this.localProxy.host = data?.host;
this.localProxy.port = data?.port;
this.localProxy.protocol = data?.protocol;
this.localProxy.username = data?.username;
this.localProxy.password = data?.password;
if (data?.enabled) {
this.localProxy.enabled = true;
this.localProxy.host = data?.host;
this.localProxy.port = data?.port;
this.localProxy.protocol = data?.protocol;
this.localProxy.username = data?.username;
this.localProxy.password = data?.password;
}
}
public async setProxy(data: ProxyDto) {