zeegeedee commited on
Commit
ea19841
·
verified ·
1 Parent(s): 791f9f2

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +13 -0
server.py CHANGED
@@ -53,6 +53,19 @@ app.add_middleware(
53
  allow_headers=["*"],
54
  )
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  @app.get("/")
57
  @app.head("/")
58
  async def health_check():
 
53
  allow_headers=["*"],
54
  )
55
 
56
+ MAINTENANCE_FILENAME = "maintenance.json"
57
+ LOCAL_MAINTENANCE_PATH = os.path.join("/data", MAINTENANCE_FILENAME)
58
+
59
+ def load_maintenance():
60
+ if os.path.exists(LOCAL_MAINTENANCE_PATH):
61
+ with open(LOCAL_MAINTENANCE_PATH, "r", encoding="utf-8") as f:
62
+ return json.load(f).get("maintenance", False)
63
+ return False
64
+
65
+ @app.get("/maintenance")
66
+ async def get_maintenance():
67
+ return {"maintenance": load_maintenance()}
68
+
69
  @app.get("/")
70
  @app.head("/")
71
  async def health_check():