API key check implemented
This commit is contained in:
parent
94095288b7
commit
0476167823
@ -27,4 +27,8 @@ async def apikey_put(apikey: APIKey = Depends(get_api_key)):
|
|||||||
if path.exists(path.join(configGet("data", "locations"), apikey)): # type: ignore
|
if path.exists(path.join(configGet("data", "locations"), apikey)): # type: ignore
|
||||||
move(path.join(configGet("data", "locations"), apikey), path.join(configGet("data", "locations"), new_key)) # type: ignore
|
move(path.join(configGet("data", "locations"), apikey), path.join(configGet("data", "locations"), new_key)) # type: ignore
|
||||||
|
|
||||||
return UJSONResponse({"apikey": new_key})
|
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."})
|
Loading…
Reference in New Issue
Block a user