mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
fix error after logout and try to get status or to connect again
This commit is contained in:
parent
573e56cd8c
commit
75b48aa8ac
@ -12,6 +12,8 @@
|
||||
|
||||
* Adjust dockerfile variables
|
||||
* tweaks in docker-compose to pass variables
|
||||
* Adjust the route getProfileBusiness to fetchProfileBusiness
|
||||
* fix error after logout and try to get status or to connect again
|
||||
|
||||
# 1.0.9 (2023-06-10)
|
||||
|
||||
|
@ -75,11 +75,13 @@ export class ChatController {
|
||||
return await this.waMonitor.waInstances[instanceName].updatePrivacySettings(data);
|
||||
}
|
||||
|
||||
public async getBusinessProfile(
|
||||
public async fetchBusinessProfile(
|
||||
{ instanceName }: InstanceDto,
|
||||
data: ProfilePictureDto,
|
||||
) {
|
||||
return await this.waMonitor.waInstances[instanceName].getBusinessProfile(data.number);
|
||||
return await this.waMonitor.waInstances[instanceName].fetchBusinessProfile(
|
||||
data.number,
|
||||
);
|
||||
}
|
||||
|
||||
public async updateProfileName({ instanceName }: InstanceDto, data: ProfileNameDto) {
|
||||
|
@ -100,7 +100,7 @@ export class InstanceController {
|
||||
public async connectToWhatsapp({ instanceName }: InstanceDto) {
|
||||
try {
|
||||
const instance = this.waMonitor.waInstances[instanceName];
|
||||
const state = instance.connectionStatus?.state;
|
||||
const state = instance?.connectionStatus?.state ?? null;
|
||||
|
||||
switch (state) {
|
||||
case 'close':
|
||||
@ -118,7 +118,7 @@ export class InstanceController {
|
||||
}
|
||||
|
||||
public async connectionState({ instanceName }: InstanceDto) {
|
||||
return this.waMonitor.waInstances[instanceName].connectionStatus;
|
||||
return this.waMonitor.waInstances[instanceName]?.connectionStatus;
|
||||
}
|
||||
|
||||
public async fetchInstances({ instanceName }: InstanceDto) {
|
||||
|
@ -163,12 +163,13 @@ export class ChatRouter extends RouterBroker {
|
||||
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
})
|
||||
.post(this.routerPath('getBusinessProfile'), ...guards, async (req, res) => {
|
||||
.post(this.routerPath('fetchBusinessProfile'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<ProfilePictureDto>({
|
||||
request: req,
|
||||
schema: profilePictureSchema,
|
||||
ClassRef: ProfilePictureDto,
|
||||
execute: (instance, data) => chatController.getBusinessProfile(instance, data),
|
||||
execute: (instance, data) =>
|
||||
chatController.fetchBusinessProfile(instance, data),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
|
@ -29,9 +29,6 @@ import makeWASocket, {
|
||||
WAMessage,
|
||||
WAMessageUpdate,
|
||||
WASocket,
|
||||
WAReadReceiptsValue,
|
||||
WAPrivacyValue,
|
||||
WAPrivacyOnlineValue,
|
||||
} from '@evolution/base';
|
||||
import {
|
||||
Auth,
|
||||
@ -1502,6 +1499,9 @@ export class WAStartupService {
|
||||
await this.client.updateOnlinePrivacy(settings.privacySettings.online);
|
||||
await this.client.updateLastSeenPrivacy(settings.privacySettings.last);
|
||||
await this.client.updateGroupsAddPrivacy(settings.privacySettings.groupadd);
|
||||
|
||||
// reinicia a instancia
|
||||
|
||||
return { update: 'success', data: await this.client.fetchPrivacySettings() };
|
||||
} catch (error) {
|
||||
throw new InternalServerErrorException(
|
||||
@ -1511,7 +1511,7 @@ export class WAStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
public async getBusinessProfile(number: string) {
|
||||
public async fetchBusinessProfile(number: string) {
|
||||
try {
|
||||
let jid;
|
||||
|
||||
|
24
start.sh
Normal file
24
start.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$DOCKER_ENV" = "true" ];
|
||||
then
|
||||
echo "Enabling environment variables for Docker"
|
||||
echo "DOCKER_ENV=$DOCKER_ENV"
|
||||
echo
|
||||
else
|
||||
cp ./src/env.yml ./dist/src
|
||||
fi
|
||||
echo "> removing dist"
|
||||
rm -rf ./dist
|
||||
echo
|
||||
echo "> transpiling..."
|
||||
npm run build
|
||||
|
||||
echo
|
||||
echo "> Successfully build "
|
||||
|
||||
echo
|
||||
echo "> Starting application..."
|
||||
echo
|
||||
|
||||
node ./dist/src/main.js
|
Loading…
Reference in New Issue
Block a user