updated dip
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2024-06-05 11:14:02 +02:00
parent bb2a195007
commit 32ddcdc269

View File

@ -1,24 +1,36 @@
function main() { const dip_ip = document.getElementById("dip_ip");
let ip = ""; const dip_hostname = document.getElementById("dip_hostname");
let dip_ip = document.getElementById("dip_ip"); const dip_city = document.getElementById("dip_city");
let dip_hostname = document.getElementById("dip_hostname"); const dip_country = document.getElementById("dip_country");
let dip_city = document.getElementById("dip_city"); const dip_as_number = document.getElementById("dip_as_number");
let dip_country = document.getElementById("dip_country"); const dip_as_org = document.getElementById("dip_as_org");
let dip_as_number = document.getElementById("dip_as_number");
let dip_as_org = document.getElementById("dip_as_org");
if (window.location.pathname.length > 4) { function setData(res) {
ip = window.location.pathname.split("/")[1];
}
fetch(`/json/${ip}`).then((response) => {
response.json().then((res) => {
dip_ip.innerHTML = res["ip"]; dip_ip.innerHTML = res["ip"];
dip_hostname.innerHTML = res["hostname"]; dip_hostname.innerHTML = res["hostname"];
dip_city.innerHTML = res["city"]; dip_city.innerHTML = res["city"];
dip_country.innerHTML = res["country"]; dip_country.innerHTML = res["country"];
dip_as_number.innerHTML = res["as"]["number"]; dip_as_number.innerHTML = res["as"]["number"];
dip_as_org.innerHTML = res["as"]["org"]; dip_as_org.innerHTML = res["as"]["org"];
}
function main() {
let ip = "";
if (window.location.pathname.length > 4) {
ip = window.location.pathname.split("/")[1];
}
const localdata = localStorage.getItem("data");
if (localdata) {
const data = JSON.parse(localdata);
setData(data);
}
fetch(`/json/${ip}`).then((response) => {
response.json().then((data) => {
setData(data);
localStorage.setItem("data",JSON.stringify(data));
}); });
}); });
} }