diff --git a/handlers/apiIsOnlineHandler.py b/handlers/apiIsOnlineHandler.py index 9664868..c630660 100644 --- a/handlers/apiIsOnlineHandler.py +++ b/handlers/apiIsOnlineHandler.py @@ -9,12 +9,19 @@ def GETApiIsOnline(): data = {"message": "unknown error"} try: # Check arguments - if "u" not in bottle.request.query: + if "u" not in bottle.request.query and "id" not in bottle.request.query: raise exceptions.invalidArgumentsException() # Get online staus - username = bottle.request.query["u"] - data["result"] = True if glob.tokens.getTokenFromUsername(username) != None else False + if "u" in bottle.request.query: + username = bottle.request.query["u"] + data["result"] = True if glob.tokens.getTokenFromUsername(username) != None else False + else: + try: + userID = int(bottle.request.query["id"]) + data["result"] = True if glob.tokens.getTokenFromUserID(userID) != None else False + except: + raise exceptions.invalidArgumentsException() # Status code and message statusCode = 200