blob: 98f22ab222e15e9804fdc765ae6ca1ffea020049 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<!DOCTYPE html>
<html>
<head>
<title>webiot</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./simple.css" type="text/css">
</head>
<body>
<header>
<h1>webiot</h1>
<p>A simple IoT web server</p>
</header>
<main>{{range .Hs100}}
<section>
<p><strong>{{.Name}}</strong></p>
<button onclick="api('{{.Ip}}', 'on')">on</button>
<button class="card-last-item" onclick="api('{{.Ip}}', 'off')">off</button>
</section>{{end}}
<footer>
<center>
<p><a href="https://xengineering.eu/git/webiot">webiot</a>
is licensed under <a href="https://www.gnu.org/licenses/agpl-3.0.en.html">AGPL v3</a> and developed
with <a href="https://simplecss.org/">simple.css</a>.</p>
</center>
</footer>
<script>
function api(host, state) {
const xhttp = new XMLHttpRequest();
xhttp.open(
"POST",
"/api?host=" + host + "&state=" + state,
true
);
xhttp.send();
}
</script>
</main>
</body>
</html>
|