Add method islockedbyme
This commit is contained in:
11
main.py
11
main.py
@@ -101,13 +101,20 @@ async def fastapi_dump_output(output: str) -> str:
|
|||||||
|
|
||||||
@app.get("/isprojectlocked/")
|
@app.get("/isprojectlocked/")
|
||||||
async def fastapi_is_locked(network: str, req: Request):
|
async def fastapi_is_locked(network: str, req: Request):
|
||||||
|
return str in lockedPrjs.keys()
|
||||||
|
|
||||||
|
@app.get("/isprojectlockedbyme/")
|
||||||
|
async def fastapi_is_locked_by_me(network: str, req: Request):
|
||||||
client_host = f'{req.client.host}:{req.client.port}'
|
client_host = f'{req.client.host}:{req.client.port}'
|
||||||
return lockedPrjs.get(network) != client_host
|
return lockedPrjs.get(network) == client_host
|
||||||
|
|
||||||
@app.post("/lockproject/")
|
@app.post("/lockproject/")
|
||||||
async def fastapi_lock_project(network: str, req: Request):
|
async def fastapi_lock_project(network: str, req: Request):
|
||||||
client_host = f'{req.client.host}:{req.client.port}'
|
client_host = f'{req.client.host}:{req.client.port}'
|
||||||
lockedPrjs[network] = client_host
|
|
||||||
|
if fastapi_is_locked(str, req) == False:
|
||||||
|
lockedPrjs[network] = client_host
|
||||||
|
|
||||||
return client_host
|
return client_host
|
||||||
|
|
||||||
@app.post("/unlockproject/")
|
@app.post("/unlockproject/")
|
||||||
|
|||||||
Reference in New Issue
Block a user