Merge pull request 'Improve style' (#8) from mark22k/myip.dn42:master into master

Reviewed-on: https://git.dn42.dev/lare/myip.dn42/pulls/8
This commit is contained in:
lare 2023-09-23 16:49:10 +01:00
commit 62fa32803c
2 changed files with 51 additions and 51 deletions

45
wwwroot/assets/js/myip.js Normal file
View file

@ -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://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();
}

View file

@ -14,55 +14,10 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="shortcut icon" type="image/x-icon href="/favicon.ico">
<link rel="stylesheet" href="/assets/css/normalize.css" integrity="sha384-M86HUGbBFILBBZ9ykMAbT3nVb0+2C7yZlF8X2CiKNpDOQjKroMJqIeGZ/Le8N2Qp">
<link rel="stylesheet" href="/assets/css/simple.min.css" integrity="sha384-ZLDMtZ+NjwNE3nk4wWLGpX4atVTD4fql9ruaAw2xFz7CLPlFcwrifgX2HgkdX6X7">
<script>
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;
})
<link rel="stylesheet" href="/assets/css/normalize.css">
<link rel="stylesheet" href="/assets/css/simple.min.css">
}
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();
}
</script>
<script src="/assets/js/myip.js"></script>
</head>
<body>
<header>
@ -77,9 +32,9 @@
</div>
<div>
<h2>Remote Node</h2>
The node's ip address is <span id="serverdefault">fetching from <a href="/api">api</a></span>. <br>
The node's ipv4 address is <span id="serveripv4">fetching from <a href="http://v4.myip.dn42/api">api</a></span>.<br>
The node's ipv6 address is <span id="serveripv6">fetching from <a href="http://v6.myip.dn42/api">api</a></span>.<br>
The node's ip address is <span id="serverdefault">fetching from <a href="/api">api</a></span>.<br>
The node's ipv4 address is <span id="serveripv4">fetching from <a href="http://172.20.0.81/api">api</a></span>.<br>
The node's ipv6 address is <span id="serveripv6">fetching from <a href="http://[fd42:d42:d42:81::1]/api">api</a></span>.<br>
You have reached the myip.dn42 service of AS<span id="node_as">fetching from <a href="/api">api</a></span>. The server is located in <span id="node_location">fetching from <a href="/api">api</a></span> . The server has the ID/name <code id="node_id">fetching from <a href="/api">api</a></code>.
</div>
</main>