change html template
All checks were successful
Build docker container / Build image (push) Successful in 28s
All checks were successful
Build docker container / Build image (push) Successful in 28s
This commit is contained in:
parent
7c3c156139
commit
ef915583aa
2
main.go
2
main.go
@ -99,7 +99,7 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "/raw":
|
case "/raw":
|
||||||
fmt.Fprintf(w, "%s\n%s\n", netAddr.Address, netAddr.Type)
|
fmt.Fprintf(w, "%s\n", netAddr.Address)
|
||||||
case "/json":
|
case "/json":
|
||||||
responseJSON(w, netAddr)
|
responseJSON(w, netAddr)
|
||||||
default:
|
default:
|
||||||
|
@ -4,10 +4,50 @@
|
|||||||
<title>My IP</title>
|
<title>My IP</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<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>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
IP: {{ .Address }}<br />
|
<ul id="ips">
|
||||||
IP: {{ .Type}}<br />
|
<li>
|
||||||
|
<span class="noselect">{{ .Type }}: </span><b>{{ .Address }}</b>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
async function getIp() {
|
async function getIp() {
|
||||||
@ -17,6 +57,15 @@
|
|||||||
const response = await fetch(requestUrl);
|
const response = await fetch(requestUrl);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
getIp();
|
getIp();
|
||||||
|
Loading…
Reference in New Issue
Block a user