ip-svc/templates/index.html

25 lines
549 B
HTML
Raw Normal View History

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">
</head>
<body>
2024-06-03 11:53:42 +00:00
IP: {{ .Address }}<br />
IP: {{ .Type}}<br />
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();
console.log(data)
}
getIp();
</script>
2024-06-02 20:09:02 +00:00
</html>