Fix relax replay incrementing, do not send flag webhook if len not >1
This commit is contained in:
parent
1c6aea6729
commit
dba93f8bb3
|
@ -36,7 +36,11 @@ class handler(requestsManager.asyncRequestHandler):
|
||||||
username = self.get_argument("u")
|
username = self.get_argument("u")
|
||||||
password = self.get_argument("h")
|
password = self.get_argument("h")
|
||||||
replayID = self.get_argument("c")
|
replayID = self.get_argument("c")
|
||||||
s = rxscore.score()
|
|
||||||
|
isRelaxing = False
|
||||||
|
if int(replayID) < 500000000:
|
||||||
|
isRelaxing = True
|
||||||
|
|
||||||
# Login check
|
# Login check
|
||||||
userID = userUtils.getID(username)
|
userID = userUtils.getID(username)
|
||||||
if userID == 0:
|
if userID == 0:
|
||||||
|
@ -46,19 +50,11 @@ class handler(requestsManager.asyncRequestHandler):
|
||||||
if userUtils.check2FA(userID, ip):
|
if userUtils.check2FA(userID, ip):
|
||||||
raise exceptions.need2FAException(MODULE_NAME, username, ip)
|
raise exceptions.need2FAException(MODULE_NAME, username, ip)
|
||||||
|
|
||||||
# Get user ID
|
replayData = glob.db.fetch("SELECT scores{relax}.*, users.username AS uname FROM scores{relax} LEFT JOIN users ON scores{relax}.userid = users.id WHERE scores{relax}.id = %s".format(relax="_relax" if isRelaxing else ""), [replayID])
|
||||||
if bool(s.mods & 128): # Relax
|
|
||||||
replayData = glob.db.fetch("SELECT scores_relax.*, users.username AS uname FROM scores_relax LEFT JOIN users ON scores_relax.userid = users.id WHERE scores_relax.id = %s", [replayID])
|
# Increment 'replays watched by others' if needed
|
||||||
# Increment 'replays watched by others' if needed
|
if replayData is not None:
|
||||||
if replayData is not None:
|
userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], replayData["mods"])
|
||||||
if username != replayData["uname"]:
|
|
||||||
userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], s.mods)
|
|
||||||
else:
|
|
||||||
replayData = glob.db.fetch("SELECT scores.*, users.username AS uname FROM scores LEFT JOIN users ON scores.userid = users.id WHERE scores.id = %s", [replayID])
|
|
||||||
# Increment 'replays watched by others' if needed
|
|
||||||
if replayData is not None:
|
|
||||||
if username != replayData["uname"]:
|
|
||||||
userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], s.mods)
|
|
||||||
|
|
||||||
log.info("Serving replay_{}.osr".format(replayID))
|
log.info("Serving replay_{}.osr".format(replayID))
|
||||||
fileName = ".data/replays/replay_{}.osr".format(replayID)
|
fileName = ".data/replays/replay_{}.osr".format(replayID)
|
||||||
|
|
|
@ -238,9 +238,10 @@ class handler(requestsManager.asyncRequestHandler):
|
||||||
haxFlags = scoreData[17].count(' ') # 4 is normal, 0 is irregular but inconsistent.
|
haxFlags = scoreData[17].count(' ') # 4 is normal, 0 is irregular but inconsistent.
|
||||||
if haxFlags != 4 and haxFlags != 0 and s.completed > 1 and restricted == False:
|
if haxFlags != 4 and haxFlags != 0 and s.completed > 1 and restricted == False:
|
||||||
|
|
||||||
flagsReadable = generalUtils.calculateFlags(haxFlags, used_mods, s.gameMode)
|
flagsReadable = generalUtils.calculateFlags(int(haxFlags), used_mods, s.gameMode)
|
||||||
userUtils.appendNotes(userID, "-- has received clientside flags: {} [{}] (cheated score id: {})".format(haxFlags, flagsReadable, s.scoreID))
|
if len(flagsReadable) > 1:
|
||||||
log.warning("**{}** ({}) has received clientside anti cheat flags.\n\nFlags: {}.\n[{}]\n\nScore ID: {scoreID}\nReplay: https://akatsuki.pw/web/replays/{scoreID}".format(username, userID, haxFlags, flagsReadable, scoreID=s.scoreID), "cm")
|
userUtils.appendNotes(userID, "-- has received clientside flags: {} [{}] (cheated score id: {})".format(haxFlags, flagsReadable, s.scoreID))
|
||||||
|
log.warning("**{}** ({}) has received clientside anti cheat flags.\n\nFlags: {}.\n[{}]\n\nScore ID: {scoreID}\nReplay: https://akatsuki.pw/web/replays/{scoreID}".format(username, userID, haxFlags, flagsReadable, scoreID=s.scoreID), "cm")
|
||||||
|
|
||||||
if s.score < 0 or s.score > (2 ** 63) - 1:
|
if s.score < 0 or s.score > (2 ** 63) - 1:
|
||||||
userUtils.ban(userID)
|
userUtils.ban(userID)
|
||||||
|
|
Reference in New Issue
Block a user