diff --git a/pep.py b/pep.py index cc75889..6cd806a 100644 --- a/pep.py +++ b/pep.py @@ -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'])