.BANCHO. Add /api/v1/isOnline
This commit is contained in:
parent
651b53cf77
commit
e5d4e2e17a
14
pep.py
14
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'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user