From fc1a6e686a77ebbb456015d2eb5e06efa3661880 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Sun, 25 Jun 2023 14:29:31 +0200 Subject: [PATCH] Fix ip check --- index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 7a57b01..842aca6 100644 --- a/index.js +++ b/index.js @@ -70,16 +70,15 @@ async function vpnConnect(vpnName) { await sleep(1000); } else { - const response = await fetch('https://api.ipify.org', { + const response = await fetch('https://api.ipify.org/?format=json', { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, }); - console.log(response); - console.log(response.json()); - const ip = await response.json(); + const res = await response.json(); + const ip = res.data.ip; consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip.data}).`, 'info'); return 0; }