diff options
-rw-r--r-- | .gitmodules | 6 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | appdata/index.html.tmpl | 54 | ||||
l--------- | appdata/simple.css | 1 | ||||
l--------- | appdata/webiot.css | 1 | ||||
m--------- | libweb | 0 | ||||
-rw-r--r-- | main.go | 4 | ||||
m--------- | simple.css | 0 |
8 files changed, 36 insertions, 32 deletions
diff --git a/.gitmodules b/.gitmodules index 774fbe7..a3875af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "libweb"] - path = libweb - url = https://cgit.xengineering.eu/libweb/ +[submodule "simple.css"] + path = simple.css + url = https://github.com/kevquirk/simple.css.git @@ -19,7 +19,7 @@ install: all install -Dm 755 build/$(PROGRAM) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM) install -Dm 644 config.json $(DESTDIR)/etc/$(PROGRAM)/config.json install -Dm 644 appdata/index.html.tmpl $(DESTDIR)$(PREFIX)/share/$(PROGRAM)/index.html.tmpl - install -Dm 644 appdata/webiot.css $(DESTDIR)$(PREFIX)/share/$(PROGRAM)/webiot.css + install -Dm 644 appdata/simple.css $(DESTDIR)$(PREFIX)/share/$(PROGRAM)/simple.css install -Dm 644 systemd/$(PROGRAM).service $(DESTDIR)$(PREFIX)/lib/systemd/system/$(PROGRAM).service install -Dm 644 systemd/$(PROGRAM).sysusers $(DESTDIR)$(PREFIX)/lib/sysusers.d/$(PROGRAM).conf diff --git a/appdata/index.html.tmpl b/appdata/index.html.tmpl index 17c67c1..131d4c1 100644 --- a/appdata/index.html.tmpl +++ b/appdata/index.html.tmpl @@ -1,9 +1,5 @@ <!DOCTYPE html> -<!-- - vim: shiftwidth=4 tabstop=4 noexpandtab ---> - <html> <head> @@ -12,35 +8,43 @@ <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="stylesheet" href="./webiot.css" type="text/css"> + <link rel="stylesheet" href="./simple.css" type="text/css"> </head> <body> - <main> - - <h1>IoT</h1> + <header> + <h1>webiot</h1> + <p>A simple IoT web server</p> + </header> - {{range .Hs100}} - <div class="card"> - <h3 class="card-first-item">{{.Name}}</h3> + <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> - </div> - {{end}} - - <script> - function api(host, state) { - const xhttp = new XMLHttpRequest(); - xhttp.open( - "POST", - "/api?host=" + host + "&state=" + state, - true - ); - xhttp.send(); - } - </script> + </section>{{end}} + + <footer> + <center> + <p><a href="https://xengineering.eu/git/webiot">webiot</a> + is licensed under <a href="">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> diff --git a/appdata/simple.css b/appdata/simple.css new file mode 120000 index 0000000..8f905d1 --- /dev/null +++ b/appdata/simple.css @@ -0,0 +1 @@ +../simple.css/simple.css
\ No newline at end of file diff --git a/appdata/webiot.css b/appdata/webiot.css deleted file mode 120000 index 9dd798c..0000000 --- a/appdata/webiot.css +++ /dev/null @@ -1 +0,0 @@ -../libweb/libweb.css
\ No newline at end of file diff --git a/libweb b/libweb deleted file mode 160000 -Subproject d1e432e4bd53d5214fc2ac1fbb01393bf9c425f @@ -36,7 +36,7 @@ func main() { c := parseConfig(configPath) http.HandleFunc("/", index(c.Devices, appdata)) http.HandleFunc("/api", api()) - http.HandleFunc("/webiot.css", css(appdata)) + http.HandleFunc("/simple.css", css(appdata)) fmt.Printf("Serving at http://%s\n", c.Web.Listen) log.Fatal(http.ListenAndServe(c.Web.Listen.String(), nil)) } @@ -90,7 +90,7 @@ func index(devices DevicesConfig, appdata string) func(http.ResponseWriter, *htt func css(appdata string) func(http.ResponseWriter, *http.Request) { // read CSS file - path := filepath.Join(appdata, "webiot.css") + path := filepath.Join(appdata, "simple.css") css := string(mustRead(path)) return func(w http.ResponseWriter, r *http.Request) { diff --git a/simple.css b/simple.css new file mode 160000 +Subproject b8f82ae51e294cb9540147f7fe212dedd1f3cb2 |