2023-07-13 22:25:21 +02:00
|
|
|
function main() {
|
2023-07-17 21:12:44 +02:00
|
|
|
let ip = "";
|
2023-07-13 22:25:21 +02:00
|
|
|
let dip_ip = document.getElementById("dip_ip");
|
|
|
|
let dip_hostname = document.getElementById("dip_hostname");
|
|
|
|
let dip_city = document.getElementById("dip_city");
|
2023-07-15 16:56:11 +02:00
|
|
|
let dip_country = document.getElementById("dip_country");
|
2023-07-13 22:25:21 +02:00
|
|
|
let dip_as_number = document.getElementById("dip_as_number");
|
|
|
|
let dip_as_org = document.getElementById("dip_as_org");
|
2020-03-10 14:58:59 +01:00
|
|
|
|
2023-07-17 21:12:44 +02:00
|
|
|
if (window.location.pathname.length > 4) {
|
|
|
|
ip = window.location.pathname.split("/")[1];
|
|
|
|
}
|
|
|
|
|
2023-07-13 22:25:21 +02:00
|
|
|
fetch(`/json/${ip}`).then((response) => {
|
|
|
|
response.json().then((res) => {
|
|
|
|
dip_ip.innerHTML = res["ip"];
|
|
|
|
dip_hostname.innerHTML = res["hostname"];
|
|
|
|
dip_city.innerHTML = res["city"];
|
2023-07-15 16:56:11 +02:00
|
|
|
dip_country.innerHTML = res["country"];
|
2023-07-13 22:25:21 +02:00
|
|
|
dip_as_number.innerHTML = res["as"]["number"];
|
|
|
|
dip_as_org.innerHTML = res["as"]["org"];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|