Add license

This commit is contained in:
Howl
2016-06-10 13:15:42 +02:00
committed by Nyo
parent f0f90b0c53
commit 93508624c4
7 changed files with 85 additions and 39 deletions

View File

@@ -29,6 +29,8 @@ def logMessage(message, alertType = "INFO", messageColor = bcolors.ENDC, discord
typeColor = bcolors.RED
elif alertType == "CHAT":
typeColor = bcolors.BLUE
elif alertType == "DEBUG":
typeColor = bcolors.PINK
else:
typeColor = bcolors.ENDC

View File

@@ -317,3 +317,19 @@ def IPLog(userID, ip):
"""
glob.db.execute("""INSERT INTO ip_user (userid, ip, occurencies) VALUES (%s, %s, '1')
ON DUPLICATE KEY UPDATE occurencies = occurencies + 1""", [userID, ip])
def saveBanchoSession(userID, ip):
"""
Save userid and ip of this token in bancho_sessions table.
Used to cache logins on LETS requests
"""
log.debug("Saving bancho session ({}::{}) in db".format(userID, ip))
glob.db.execute("INSERT INTO bancho_sessions (id, userid, ip) VALUES (NULL, %s, %s)", [userID, ip])
def deleteBanchoSessions(userID, ip):
"""Delete this bancho session from DB"""
log.debug("Deleting bancho session ({}::{}) from db".format(userID, ip))
try:
glob.db.execute("DELETE FROM bancho_sessions WHERE userid = %s AND ip = %s", [userID, ip])
except:
log.warning("Token for user: {} ip: {} doesn't exist".format(userID, ip))