Add method to lock/unlock
This commit is contained in:
17
main.py
17
main.py
@@ -100,17 +100,20 @@ async def fastapi_dump_output(output: str) -> str:
|
||||
return dump_output(output)
|
||||
|
||||
@app.get("/isprojectlocked/")
|
||||
async def fastapi_is_locked(network: str):
|
||||
return lockedPrjs.get(network) != None
|
||||
async def fastapi_is_locked(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
return lockedPrjs.get(network) != client_host
|
||||
|
||||
@app.post("/lockproject/")
|
||||
async def fastapi_lock_project(network: str, id: str):
|
||||
lockedPrjs[network] = id
|
||||
return True
|
||||
async def fastapi_lock_project(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
lockedPrjs[network] = client_host
|
||||
return client_host
|
||||
|
||||
@app.post("/unlockproject/")
|
||||
async def fastapi_unlock_project(network: str, id: str):
|
||||
if lockedPrjs[network] == id:
|
||||
async def fastapi_unlock_project(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
if lockedPrjs[network] == client_host:
|
||||
del lockedPrjs[network]
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user