2024-06-02 20:09:02 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<title>My IP</title>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2024-06-03 12:15:07 +00:00
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
font-size: 5rem;
|
|
|
|
color: #333;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
height: 100vh;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
ul {
|
|
|
|
list-style: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
background: #fff;
|
|
|
|
border-radius: 8px;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
li {
|
|
|
|
padding: 15px 20px;
|
|
|
|
border-bottom: 1px solid #ddd;
|
|
|
|
}
|
|
|
|
li:last-child {
|
|
|
|
border-bottom: none;
|
|
|
|
}
|
|
|
|
.noselect {
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
color: #555;
|
|
|
|
}
|
|
|
|
b {
|
|
|
|
color: #000;
|
|
|
|
}
|
|
|
|
</style>
|
2024-06-02 20:09:02 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2024-06-03 12:15:07 +00:00
|
|
|
<ul id="ips">
|
|
|
|
<li>
|
|
|
|
<span class="noselect">{{ .Type }}: </span><b>{{ .Address }}</b>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2024-06-02 20:09:02 +00:00
|
|
|
</body>
|
2024-06-03 11:53:42 +00:00
|
|
|
<script>
|
|
|
|
async function getIp() {
|
|
|
|
const isIpv4 = "{{ .Type }}" == "IPv4";
|
|
|
|
let requestUrl = isIpv4 ? "https://ip6.mziesel.nl/json" : "https://ip4.mziesel.nl/json";
|
|
|
|
|
|
|
|
const response = await fetch(requestUrl);
|
|
|
|
const data = await response.json();
|
|
|
|
|
2024-06-03 12:15:07 +00:00
|
|
|
const ul = document.getElementById("ips")
|
|
|
|
|
|
|
|
if (data.address) {
|
|
|
|
let child = document.createElement("li")
|
|
|
|
child.innerHTML = `<span class="noselect">${data.type}: </span><b>${data.address}</b>`
|
|
|
|
|
|
|
|
ul.appendChild(child)
|
|
|
|
}
|
|
|
|
|
2024-06-03 11:53:42 +00:00
|
|
|
console.log(data)
|
|
|
|
}
|
|
|
|
getIp();
|
|
|
|
</script>
|
2024-06-02 20:09:02 +00:00
|
|
|
</html>
|