Fix ip check

This commit is contained in:
2023-06-25 14:29:31 +02:00
parent e2d84918d6
commit fc1a6e686a

View File

@@ -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;
}