Persistent Storage on reload, Start and Stop buttons
This commit is contained in:
20
main.py
20
main.py
@@ -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)
|
||||
|
||||
|
||||
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user