From f32e259d2ff5cb67dd33f783d3e3bea4bf56c3e5 Mon Sep 17 00:00:00 2001 From: Helio Elias Date: Tue, 8 Aug 2023 21:06:58 -0300 Subject: [PATCH] Fix isURL function to by pass url with localhost, when webhook is enable --- src/install-evolution-api-ws.ts | 15 --------------- src/uninstall-evolution-api-ws.ts | 16 ---------------- src/whatsapp/services/whatsapp.service.ts | 2 +- 3 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 src/install-evolution-api-ws.ts delete mode 100644 src/uninstall-evolution-api-ws.ts diff --git a/src/install-evolution-api-ws.ts b/src/install-evolution-api-ws.ts deleted file mode 100644 index 1faadbf9..00000000 --- a/src/install-evolution-api-ws.ts +++ /dev/null @@ -1,15 +0,0 @@ -import nodeWindows from 'node-windows'; -import path from 'path'; - -const svc = new nodeWindows.Service({ - name: 'EvolutionAPIServer', - description: - 'WhatsApp-Api-NodeJs - This project is based on the CodeChat. The original project is an implementation of Baileys', - script: path.join(__dirname, 'main.js'), -}); - -svc.on('install', () => { - svc.start(); -}); - -svc.install(); diff --git a/src/uninstall-evolution-api-ws.ts b/src/uninstall-evolution-api-ws.ts deleted file mode 100644 index 4311f503..00000000 --- a/src/uninstall-evolution-api-ws.ts +++ /dev/null @@ -1,16 +0,0 @@ -import nodeWindows from 'node-windows'; -import path from 'path'; - -const svc = new nodeWindows.Service({ - name: 'EvolutionAPIServer', - description: - 'WhatsApp-Api-NodeJs - This project is based on the CodeChat. The original project is an implementation of Baileys', - script: path.join(__dirname, 'main.js'), -}); - -svc.on('uninstall', () => { - console.log('Uninstall complete.'); - console.log('The service exists: ', svc.exists); -}); - -svc.uninstall(); diff --git a/src/whatsapp/services/whatsapp.service.ts b/src/whatsapp/services/whatsapp.service.ts index 6de7d847..dc82a516 100644 --- a/src/whatsapp/services/whatsapp.service.ts +++ b/src/whatsapp/services/whatsapp.service.ts @@ -453,7 +453,7 @@ export class WAStartupService { } try { - if (this.localWebhook.enabled && isURL(this.localWebhook.url)) { + if (this.localWebhook.enabled && isURL(this.localWebhook.url, { require_tld: false })) { const httpService = axios.create({ baseURL }); const postData = { event,