Use ip + port to identify the client
This commit is contained in:
6
main.py
6
main.py
@@ -101,18 +101,18 @@ async def fastapi_dump_output(output: str) -> str:
|
||||
|
||||
@app.get("/isprojectlocked/")
|
||||
async def fastapi_is_locked(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
client_host = f'{req.client.host}:{req.client.port}'
|
||||
return lockedPrjs.get(network) != client_host
|
||||
|
||||
@app.post("/lockproject/")
|
||||
async def fastapi_lock_project(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
client_host = f'{req.client.host}:{req.client.port}'
|
||||
lockedPrjs[network] = client_host
|
||||
return client_host
|
||||
|
||||
@app.post("/unlockproject/")
|
||||
async def fastapi_unlock_project(network: str, req: Request):
|
||||
client_host = req.client.host
|
||||
client_host = f'{req.client.host}:{req.client.port}'
|
||||
if lockedPrjs[network] == client_host:
|
||||
del lockedPrjs[network]
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user