From e5d4e2e17a6998bdcd715ea3f2addbf67653c9a8 Mon Sep 17 00:00:00 2001 From: Nyo Date: Mon, 30 May 2016 22:03:47 +0200 Subject: [PATCH] .BANCHO. Add /api/v1/isOnline --- pep.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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'])