Add reset API in Dashboard

This commit is contained in:
proitlab committed 2026-07-29 15:31:14 +07:00
1 parent 2d98ea2d17
commit 7db25bf19b
3 files changed
+34

No files matched your search

+10
View File
@@ -548,6 +548,16 @@ def export_day_xlsx(date):
return _excel_response(wb, filename)
@app.route("/api/reset", methods=["POST"])
def api_reset():
try:
Path(CURRENT_BATCH_PATH).unlink(missing_ok=True)
Path(str(CURRENT_BATCH_PATH) + ".reset").touch()
except Exception:
pass
return jsonify({"success": True, "message": "State file cleared"})
if __name__ == "__main__":
WSGIRequestHandler.protocol_version = "HTTP/1.1"
print(f"Jetson counter dashboard at http://{DASHBOARD_HOST}:{DASHBOARD_PORT}")