This commit is contained in:
parent
bd33434cf2
commit
a971fd1828
4 changed files with 24 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
@ -283,9 +283,13 @@ func (s *webServer) viewButtonVent(w http.ResponseWriter, r *http.Request) {
|
||||||
s.d.ventPress()
|
s.d.ventPress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed static/*
|
||||||
|
var static embed.FS
|
||||||
|
|
||||||
func (s *webServer) setupViews() {
|
func (s *webServer) setupViews() {
|
||||||
http.HandleFunc("/", s.viewIndex)
|
http.HandleFunc("/", s.viewIndex)
|
||||||
http.HandleFunc("/favicon.png", s.viewFavicon)
|
http.HandleFunc("/favicon.png", s.viewFavicon)
|
||||||
|
http.Handle("/static/", http.FileServer(http.FS(static)))
|
||||||
http.HandleFunc("/stream", s.viewStream)
|
http.HandleFunc("/stream", s.viewStream)
|
||||||
http.HandleFunc("/metrics", s.viewMetrics)
|
http.HandleFunc("/metrics", s.viewMetrics)
|
||||||
http.HandleFunc("/button/vent", s.viewButtonVent)
|
http.HandleFunc("/button/vent", s.viewButtonVent)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
<title>succd</title>
|
<title>succd</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="shortcut icon" type="image/png" href="/favicon.png">
|
<link rel="shortcut icon" type="image/png" href="/favicon.png">
|
||||||
|
<audio src="/static/button3.wav" id="button"> </audio>
|
||||||
|
<audio src="/static/button10.wav" id="denied"> </audio>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
@ -330,6 +332,21 @@ let historicalDraw = (w, h) => {
|
||||||
window.addEventListener("load", (_) => {
|
window.addEventListener("load", (_) => {
|
||||||
console.log("s u c c");
|
console.log("s u c c");
|
||||||
|
|
||||||
|
let dpok = false;
|
||||||
|
for (const button of document.querySelectorAll("button")) {
|
||||||
|
button.addEventListener("click", (event) => {
|
||||||
|
let audio = document.querySelector('audio#button');
|
||||||
|
|
||||||
|
if (event.target.id === "dpon" && !dpok) {
|
||||||
|
audio = document.querySelector('audio#denied');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (audio !== undefined) {
|
||||||
|
audio.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let status = document.querySelector("#status");
|
let status = document.querySelector("#status");
|
||||||
let failsafe = document.querySelector("#failsafe");
|
let failsafe = document.querySelector("#failsafe");
|
||||||
let highpressure = document.querySelector("#highpressure");
|
let highpressure = document.querySelector("#highpressure");
|
||||||
|
|
@ -397,9 +414,11 @@ window.addEventListener("load", (_) => {
|
||||||
if (data.Safety.HighPressure) {
|
if (data.Safety.HighPressure) {
|
||||||
highpressure.innerHTML = "ON";
|
highpressure.innerHTML = "ON";
|
||||||
highpressure.style = colors.default;
|
highpressure.style = colors.default;
|
||||||
|
dpok = false;
|
||||||
} else {
|
} else {
|
||||||
highpressure.innerHTML = "OFF";
|
highpressure.innerHTML = "OFF";
|
||||||
highpressure.style = colors.default;
|
highpressure.style = colors.default;
|
||||||
|
dpok = true;
|
||||||
}
|
}
|
||||||
if (data.Pumps.RPOn) {
|
if (data.Pumps.RPOn) {
|
||||||
rp.innerHTML = "ON";
|
rp.innerHTML = "ON";
|
||||||
|
|
|
||||||
BIN
succbone/succd/static/button10.wav
Normal file
BIN
succbone/succd/static/button10.wav
Normal file
Binary file not shown.
BIN
succbone/succd/static/button3.wav
Normal file
BIN
succbone/succd/static/button3.wav
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue