diff --git a/wwwroot/assets/js/myip.js b/wwwroot/assets/js/myip.js new file mode 100644 index 0000000..3b75ec6 --- /dev/null +++ b/wwwroot/assets/js/myip.js @@ -0,0 +1,45 @@ +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://v4.myip.dn42/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://v6.myip.dn42/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(); +} diff --git a/wwwroot/index.html b/wwwroot/index.html index 48c4ba0..5387ec6 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -16,53 +16,8 @@ - +