This commit is contained in:
2023-06-26 09:30:30 +02:00
parent 9f882e1daf
commit 60620177a9

View File

@@ -70,16 +70,22 @@ async function vpnConnect(vpnName) {
await sleep(1000);
}
else {
const response = await fetch('https://api.ipify.org/?format=json', {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});
const res = await response.json();
const ip = res.ip;
await consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip}).`, 'info');
try {
const response = await fetch('https://api.ipify.org/?format=json', {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});
const res = await response.json();
const ip = res.ip;
await consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip}).`, 'info');
}
catch (err) {
const ip = 'Unknown';
await consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip}).`, 'info');
}
return 0;
}
}