Persistent Storage on reload, Start and Stop buttons

This commit is contained in:
2025-11-28 12:19:30 -05:00
parent 441ae31eb6
commit 4b0038a4b7
4 changed files with 129 additions and 61 deletions

20
main.py
View File

@@ -100,6 +100,26 @@ async def get_enemy_members():
return json.load(f)
# =============================
# Status JSON endpoints
# =============================
@app.get("/api/friendly_status")
async def api_friendly_status():
path = Path("data/friendly_status.json")
if not path.exists():
return {}
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
@app.get("/api/enemy_status")
async def api_enemy_status():
path = Path("data/enemy_status.json")
if not path.exists():
return {}
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
# ============================================================