Add method lockproject, unlockproject, isprojectlocked

This commit is contained in:
DingZQ
2022-09-24 22:09:12 +08:00
parent cb087ec7df
commit 579a4be000

16
main.py
View File

@@ -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):