diff --git a/extensions/devices.py b/extensions/devices.py index e0d4129..a31d84e 100644 --- a/extensions/devices.py +++ b/extensions/devices.py @@ -50,7 +50,7 @@ async def devices_post(name: str, os: str, apikey: APIKey = Depends(get_api_key) user = user_by_key(apikey) - if col_devices.count_documents({"user": user}) >= configGet("devices", "limits"): + if (configGet("devices", "limits") != -1) and (col_devices.count_documents({"user": user}) >= configGet("devices", "limits")): return UJSONResponse( { "detail": f'Too many devices. This instance allows to register only {configGet("devices", "limits")} devices per user', diff --git a/extensions/saves.py b/extensions/saves.py index 08dffab..d5f031d 100644 --- a/extensions/saves.py +++ b/extensions/saves.py @@ -137,7 +137,7 @@ async def saves_post(device: str, files: List[UploadFile], apikey: APIKey = Depe error_return = HTTPException(HTTP_406_NOT_ACCEPTABLE, detail="You must provide two files: save file and SaveGameInfo for that save") - if col_saves.count_documents({"user": user}) >= configGet("saves", "limits"): + if (configGet("saves", "limits") != -1) and (col_saves.count_documents({"user": user}) >= configGet("saves", "limits")): return UJSONResponse( { "detail": f'Too many save files. This instance allows to store only {configGet("saves", "limits")} saves per user',