.BANCHO. Add /api/v1/isOnline

This commit is contained in:
Nyo 2016-05-30 22:03:47 +02:00
parent 651b53cf77
commit e5d4e2e17a

14
pep.py
View File

@ -66,6 +66,8 @@ from helpers import responseHelper
from helpers import generalFunctions
from helpers import systemHelper
from flask import request
# Create flask instance
app = flask.Flask(__name__)
@ -108,6 +110,18 @@ def serverStatus():
"status" : -1 if glob.restarting == True else 1
})
@app.route("/api/v1/isOnline")
def apiUserOnline():
username = request.args.get("u")
if username == None:
result = False
else:
token = glob.tokens.getTokenFromUsername(username)
result = True if token != None else False
return flask.jsonify({
"result": result
})
# Main bancho server
@app.route("/", methods=['GET', 'POST'])