This commit is contained in:
gitGnome
2026-04-01 14:29:02 +02:00
parent f2625e77d0
commit 0d06ab7ff2
3 changed files with 143 additions and 2 deletions
+18
View File
@@ -19,6 +19,7 @@ state = {
'program_bottom_text_enabled': True,
'program_vehicles_enabled': True,
'force_vehicles': False,
'force_dvd': False,
}
_lock = threading.Lock()
@@ -71,6 +72,9 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
.btn-vehicles { background: #2a4a7f; color: #eee; }
.btn-vehicles:hover { background: #3a5a9f; }
.btn-vehicles:active { background: #1a3a6f; }
.btn-dvd { background: #6b2a7f; color: #eee; }
.btn-dvd:hover { background: #8b3a9f; }
.btn-dvd:active { background: #5b1a6f; }
</style>
</head>
<body>
@@ -100,6 +104,7 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
</div>
</div>
<button class="btn btn-vehicles" onclick="forceVehicles()">Force Vehicles Next Cycle</button>
<button class="btn btn-dvd" onclick="forceDvd()">Force DVD Next Cycle</button>
</div>
</div>
<script>
@@ -142,6 +147,12 @@ INDEX_HTML = """<!DOCTYPE HTML><html>
xhr.send();
}
function forceDvd() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/force-dvd", true);
xhr.send();
}
function toggle(program, enabled) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/toggle-program", true);
@@ -234,6 +245,13 @@ def handle_force_vehicles():
return 'OK'
@app.route('/force-dvd', methods=['POST'])
def handle_force_dvd():
with _lock:
state['force_dvd'] = True
return 'OK'
@app.route('/program-status', methods=['GET'])
def handle_status():
with _lock: