summaryrefslogtreecommitdiff
path: root/templates/index.html
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-03-24 21:07:44 +0100
committerxengineering <me@xengineering.eu>2024-03-24 21:12:56 +0100
commit820b15f71a4ac4aeb0c31dc6b929f2d022cff3b8 (patch)
tree3bd344625e592fc6adc9b949a894116421307bb4 /templates/index.html
parentce3a2dd68707c5c744aa019417baa12f1dab96e4 (diff)
downloadwebiot-820b15f71a4ac4aeb0c31dc6b929f2d022cff3b8.tar
webiot-820b15f71a4ac4aeb0c31dc6b929f2d022cff3b8.tar.zst
webiot-820b15f71a4ac4aeb0c31dc6b929f2d022cff3b8.zip
Replace appdata completely by embed package
The embed package makes it useless to handle static files from the source tree during runtime. All those files go simply to the embed.FS variable and are thus embedded into the binary which is easier to handle.
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..c9fa2f4
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,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="/static/simple.css/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&nbsp;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>