From 873e71b41fc6115f5a717b6d33bc329fb48434ea Mon Sep 17 00:00:00 2001 From: Adil Sadqi <42699429+AdilSadqi@users.noreply.github.com> Date: Thu, 4 Apr 2024 07:39:06 +0000 Subject: [PATCH] Update main.js.download --- index_files/main.js.download | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/index_files/main.js.download b/index_files/main.js.download index 4d3c801..95c1a01 100644 --- a/index_files/main.js.download +++ b/index_files/main.js.download @@ -182,7 +182,22 @@ function commander(cmd) { window.open('https://www.google.com'); }, 1000); break; - case "update": + case "ip": + // Function to fetch the IP address + function getIP(callback){ + // Using a free service to fetch the IP address + fetch('https://api.ipify.org?format=json') + .then(response => response.json()) + .then(data => callback(data.ip)) + .catch(error => callback("Unable to fetch IP address")); + } + + // Displaying the IP address + getIP(function(ip){ + addLine("Your current IP address is: " + ip, "color2", 80); + }); + break; + case "update": addLine("Opening Updater...", "color2", 80); setTimeout(function() { var url = '/update';