From 579a4be0003b0c7b974acb3a09a981539167b28a Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 24 Sep 2022 22:09:12 +0800 Subject: [PATCH] Add method lockproject, unlockproject, isprojectlocked --- main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.py b/main.py index edd4550..c9ced19 100644 --- a/main.py +++ b/main.py @@ -20,6 +20,8 @@ prjs = [] inpDir = "C:/inpfiles/" tmpDir = "C:/tmpfiles/" +lockedPrjs = {} + if not os.path.exists(inpDir): os.mkdir(inpDir) @@ -66,6 +68,20 @@ async def fastapi_copy_project(source: str, target: str): copy_project(source, target) return True +@app.get("/isprojectlocked/") +async def fastapi_is_locked(network: str): + return str in lockedPrjs + +@app.post("/lockproject/") +async def fastapi_lock_project(network: str, id: str): + lockedPrjs[str] = id + return True + +@app.post("/unlockproject/") +async def fastapi_unlock_project(network: str): + del lockedPrjs[str] + return True + # undo/redo @app.post("/undo/") async def fastapi_undo(network: str):