.BANCHO. Add timezones
This commit is contained in:
parent
8740465895
commit
677abae257
|
@ -94,7 +94,7 @@ def userPanel(userID, force = False):
|
||||||
|
|
||||||
# Get user data
|
# Get user data
|
||||||
username = userToken.username
|
username = userToken.username
|
||||||
timezone = 24 # TODO: Timezone
|
timezone = 24+userToken.timeOffset # TODO: Timezone
|
||||||
country = userToken.country
|
country = userToken.country
|
||||||
gameRank = userToken.gameRank
|
gameRank = userToken.gameRank
|
||||||
latitude = userToken.getLatitude()
|
latitude = userToken.getLatitude()
|
||||||
|
|
|
@ -48,6 +48,8 @@ def handle(tornadoRequest):
|
||||||
# [4] disk ID
|
# [4] disk ID
|
||||||
splitData = loginData[2].split("|")
|
splitData = loginData[2].split("|")
|
||||||
osuVersion = splitData[0]
|
osuVersion = splitData[0]
|
||||||
|
timeOffset = int(splitData[1])
|
||||||
|
print(str(timeOffset))
|
||||||
clientData = splitData[3].split(":")[:5]
|
clientData = splitData[3].split(":")[:5]
|
||||||
if len(clientData) < 4:
|
if len(clientData) < 4:
|
||||||
raise exceptions.forceUpdateException()
|
raise exceptions.forceUpdateException()
|
||||||
|
@ -104,7 +106,7 @@ def handle(tornadoRequest):
|
||||||
|
|
||||||
# Delete old tokens for that user and generate a new one
|
# Delete old tokens for that user and generate a new one
|
||||||
glob.tokens.deleteOldTokens(userID)
|
glob.tokens.deleteOldTokens(userID)
|
||||||
responseToken = glob.tokens.addToken(userID, requestIP)
|
responseToken = glob.tokens.addToken(userID, requestIP, timeOffset=timeOffset)
|
||||||
responseTokenString = responseToken.token
|
responseTokenString = responseToken.token
|
||||||
|
|
||||||
# Check restricted mode (and eventually send message)
|
# Check restricted mode (and eventually send message)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class token:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, __userID, token = None, ip = "", irc = False):
|
def __init__(self, __userID, token = None, ip = "", irc = False, timeOffset = 0):
|
||||||
"""
|
"""
|
||||||
Create a token object and set userID and token
|
Create a token object and set userID and token
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class token:
|
||||||
self.restricted = userHelper.isRestricted(self.userID)
|
self.restricted = userHelper.isRestricted(self.userID)
|
||||||
self.loginTime = int(time.time())
|
self.loginTime = int(time.time())
|
||||||
self.pingTime = self.loginTime
|
self.pingTime = self.loginTime
|
||||||
|
self.timeOffset = timeOffset
|
||||||
self.lock = threading.Lock() # Sync primitive
|
self.lock = threading.Lock() # Sync primitive
|
||||||
|
|
||||||
# Default variables
|
# Default variables
|
||||||
|
|
|
@ -19,7 +19,7 @@ class tokenList:
|
||||||
"""
|
"""
|
||||||
self.tokens = {}
|
self.tokens = {}
|
||||||
|
|
||||||
def addToken(self, userID, ip = "", irc = False):
|
def addToken(self, userID, ip = "", irc = False, timeOffset=0):
|
||||||
"""
|
"""
|
||||||
Add a token object to tokens list
|
Add a token object to tokens list
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class tokenList:
|
||||||
return -- token object
|
return -- token object
|
||||||
"""
|
"""
|
||||||
|
|
||||||
newToken = osuToken.token(userID, ip=ip, irc=irc)
|
newToken = osuToken.token(userID, ip=ip, irc=irc, timeOffset=timeOffset)
|
||||||
self.tokens[newToken.token] = newToken
|
self.tokens[newToken.token] = newToken
|
||||||
return newToken
|
return newToken
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user