diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b2efe4..9f226aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ * Adjust the route getProfileBusiness to fetchProfileBusiness * fix error after logout and try to get status or to connect again * fix sending narrated audio on whatsapp android and ios +* fixed the problem of not disabling the global webhook by the variable # 1.0.9 (2023-06-10) diff --git a/docker-compose.yaml b/docker-compose.yaml index 8b03fdcb..5858f5f1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,9 +11,9 @@ services: context: . dockerfile: Dockerfile ports: - - 8080:8080 - volumes: - - /data/instances:/evolution/instances + - 8083:8080 + # volumes: + # - /data/instances:/evolution/instances environment: # Determine how long the instance should be deleted from memory in case of no connection. # Default time: 5 minutes @@ -25,7 +25,7 @@ services: - STORE_CONTACTS=true - STORE_CHATS=true # Permanent data storage - - DATABASE_ENABLED=true + - DATABASE_ENABLED=false - DATABASE_CONNECTION_URI=mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true - DATABASE_CONNECTION_DB_PREFIX_NAME=evolution # Choose the data you want to save in the application's database or store @@ -35,7 +35,7 @@ services: - DATABASE_SAVE_MESSAGE_UPDATE=false - DATABASE_SAVE_DATA_CONTACTS=true - DATABASE_SAVE_DATA_CHATS=true - - REDIS_ENABLED=true + - REDIS_ENABLED=false - REDIS_URI=redis://redis:6379 - REDIS_PREFIX_KEY=evolution # Webhook Settings @@ -92,31 +92,31 @@ services: expose: - 8083 - mongodb: - container_name: mongodb - image: mongo - restart: always - volumes: - - /data/mongodb:/data/db - ports: - - 27017:27017 - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: root - networks: - - evolution-net - expose: - - 27017 + # mongodb: + # container_name: mongodb + # image: mongo + # restart: always + # volumes: + # - /data/mongodb:/data/db + # ports: + # - 27017:27017 + # environment: + # MONGO_INITDB_ROOT_USERNAME: root + # MONGO_INITDB_ROOT_PASSWORD: root + # networks: + # - evolution-net + # expose: + # - 27017 - redis: - container_name: redis - image: redis:latest - restart: always - volumes: - - /data/redis:/data - ports: - - 6379:6379 - networks: - - evolution-net - expose: - - 6379 \ No newline at end of file + # redis: + # container_name: redis + # image: redis:latest + # restart: always + # volumes: + # - /data/redis:/data + # ports: + # - 6379:6379 + # networks: + # - evolution-net + # expose: + # - 6379 \ No newline at end of file diff --git a/src/whatsapp/services/monitor.service.ts b/src/whatsapp/services/monitor.service.ts index fcf8f01c..03bb97e3 100644 --- a/src/whatsapp/services/monitor.service.ts +++ b/src/whatsapp/services/monitor.service.ts @@ -72,20 +72,28 @@ export class WAMonitoringService { if (this.configService.get('AUTHENTICATION').EXPOSE_IN_FETCH_INSTANCES) { const tokenStore = await this.repository.auth.find(key); apikey = tokenStore.apikey || ''; - } else { - apikey = ''; - } - instances.push({ - instance: { - instanceName: key, - owner: value.wuid, - profileName: (await value.getProfileName()) || 'not loaded', - profilePictureUrl: value.profilePictureUrl, - status: (await value.getProfileStatus()) || '', - apikey, - }, - }); + instances.push({ + instance: { + instanceName: key, + owner: value.wuid, + profileName: (await value.getProfileName()) || 'not loaded', + profilePictureUrl: value.profilePictureUrl, + status: (await value.getProfileStatus()) || '', + apikey, + }, + }); + } else { + instances.push({ + instance: { + instanceName: key, + owner: value.wuid, + profileName: (await value.getProfileName()) || 'not loaded', + profilePictureUrl: value.profilePictureUrl, + status: (await value.getProfileStatus()) || '', + }, + }); + } } else { instances.push({ instance: { diff --git a/src/whatsapp/services/whatsapp.service.ts b/src/whatsapp/services/whatsapp.service.ts index f66258a1..4c900a43 100644 --- a/src/whatsapp/services/whatsapp.service.ts +++ b/src/whatsapp/services/whatsapp.service.ts @@ -265,56 +265,59 @@ export class WAStartupService { } } } - if (webhookGlobal.EVENTS[we]) { - const globalWebhook = this.configService.get('WEBHOOK').GLOBAL; - let globalURL; + if (webhookGlobal.GLOBAL?.ENABLED) { + if (webhookGlobal.EVENTS[we]) { + const globalWebhook = this.configService.get('WEBHOOK').GLOBAL; - if (webhookGlobal.GLOBAL.WEBHOOK_BY_EVENTS) { - globalURL = `${globalWebhook.URL}/${transformedWe}`; - } else { - globalURL = globalWebhook.URL; - } + let globalURL; - let localUrl; + if (webhookGlobal.GLOBAL.WEBHOOK_BY_EVENTS) { + globalURL = `${globalWebhook.URL}/${transformedWe}`; + } else { + globalURL = globalWebhook.URL; + } - if (instance.MODE === 'container') { - localUrl = instance.WEBHOOK_URL; - } else { - localUrl = this.localWebhook.url; - } + let localUrl; - this.logger.log({ - local: WAStartupService.name + '.sendDataWebhook-global', - url: globalURL, - event, - instance: this.instance.name, - data, - destination: localUrl, - }); + if (instance.MODE === 'container') { + localUrl = instance.WEBHOOK_URL; + } else { + localUrl = this.localWebhook.url; + } - try { - if (globalWebhook && globalWebhook?.ENABLED && isURL(globalURL)) { - const httpService = axios.create({ baseURL: globalURL }); - await httpService.post('', { - event, - instance: this.instance.name, - data, - destination: localUrl, + this.logger.log({ + local: WAStartupService.name + '.sendDataWebhook-global', + url: globalURL, + event, + instance: this.instance.name, + data, + destination: localUrl, + }); + + try { + if (globalWebhook && globalWebhook?.ENABLED && isURL(globalURL)) { + const httpService = axios.create({ baseURL: globalURL }); + await httpService.post('', { + event, + instance: this.instance.name, + data, + destination: localUrl, + }); + } + } catch (error) { + this.logger.error({ + local: WAStartupService.name + '.sendDataWebhook-global', + message: error?.message, + hostName: error?.hostname, + syscall: error?.syscall, + code: error?.code, + error: error?.errno, + stack: error?.stack, + name: error?.name, + url: globalURL, }); } - } catch (error) { - this.logger.error({ - local: WAStartupService.name + '.sendDataWebhook-global', - message: error?.message, - hostName: error?.hostname, - syscall: error?.syscall, - code: error?.code, - error: error?.errno, - stack: error?.stack, - name: error?.name, - url: globalURL, - }); } } }