API key check implemented

This commit is contained in:
Profitroll 2023-01-17 10:54:23 +01:00
parent 94095288b7
commit 0476167823

View File

@ -28,3 +28,7 @@ async def apikey_put(apikey: APIKey = Depends(get_api_key)):
move(path.join(configGet("data", "locations"), apikey), path.join(configGet("data", "locations"), new_key)) # type: ignore
return UJSONResponse({"apikey": new_key})
@app.get("/apikey", response_class=UJSONResponse, description="Check API key")
async def apikey_check(apikey: APIKey = Depends(get_api_key)):
return UJSONResponse({"detail": "This key is valid."})