mirror of
https://git.dn42.dev/lare/myip.dn42.git
synced 2024-10-24 03:11:33 +02:00
This ensures that people without a working DNS but with working IP connections to the dn42 can use the JavaScript page.
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
function getdefault() {
|
|
fetch('/api')
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (data) {
|
|
document.getElementById("defaultip").innerHTML=data.ip;
|
|
document.getElementById("serverdefault").innerHTML=data.server;
|
|
document.getElementById("node_as").innerHTML=data.node_as;
|
|
document.getElementById("node_location").innerHTML=data.node_location;
|
|
document.getElementById("node_id").innerHTML=data.node_id;
|
|
})
|
|
|
|
}
|
|
|
|
function getipv4() {
|
|
fetch('http://172.20.0.81/api')
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (data) {
|
|
document.getElementById("ipv4").innerHTML=data.ip;
|
|
document.getElementById("serveripv4").innerHTML=data.server;
|
|
|
|
})
|
|
|
|
}
|
|
function getipv6() {
|
|
fetch('http://[fd42:d42:d42:81::1]/api')
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (data) {
|
|
document.getElementById("ipv6").innerHTML=data.ip;
|
|
document.getElementById("serveripv6").innerHTML=data.server;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
window.onload = function () {
|
|
getdefault();
|
|
getipv4();
|
|
getipv6();
|
|
}
|