.BANCHO. /api/v1/isOnline now supports both userid and username
This commit is contained in:
parent
7910291b77
commit
8f79e58185
|
@ -9,12 +9,19 @@ def GETApiIsOnline():
|
||||||
data = {"message": "unknown error"}
|
data = {"message": "unknown error"}
|
||||||
try:
|
try:
|
||||||
# Check arguments
|
# 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()
|
raise exceptions.invalidArgumentsException()
|
||||||
|
|
||||||
# Get online staus
|
# Get online staus
|
||||||
|
if "u" in bottle.request.query:
|
||||||
username = bottle.request.query["u"]
|
username = bottle.request.query["u"]
|
||||||
data["result"] = True if glob.tokens.getTokenFromUsername(username) != None else False
|
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
|
# Status code and message
|
||||||
statusCode = 200
|
statusCode = 200
|
||||||
|
|
Loading…
Reference in New Issue
Block a user