ip-svc/templates/index.html
Mans Ziesel c96249c0b5
All checks were successful
Build docker container / Build image (push) Successful in 30s
fix cors and add html template
2024-06-03 13:53:42 +02:00

25 lines
549 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>My IP</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
IP: {{ .Address }}<br />
IP: {{ .Type}}<br />
</body>
<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();
console.log(data)
}
getIp();
</script>
</html>