diff --git a/handlers/getReplayHandler.py b/handlers/getReplayHandler.py index 36b4420..1c16c27 100644 --- a/handlers/getReplayHandler.py +++ b/handlers/getReplayHandler.py @@ -36,7 +36,11 @@ class handler(requestsManager.asyncRequestHandler): username = self.get_argument("u") password = self.get_argument("h") replayID = self.get_argument("c") - s = rxscore.score() + + isRelaxing = False + if int(replayID) < 500000000: + isRelaxing = True + # Login check userID = userUtils.getID(username) if userID == 0: @@ -46,19 +50,11 @@ class handler(requestsManager.asyncRequestHandler): if userUtils.check2FA(userID, ip): raise exceptions.need2FAException(MODULE_NAME, username, ip) - # Get user ID - 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 - if replayData is not None: - 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) + 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]) + + # Increment 'replays watched by others' if needed + if replayData is not None: + userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], replayData["mods"]) log.info("Serving replay_{}.osr".format(replayID)) fileName = ".data/replays/replay_{}.osr".format(replayID) diff --git a/handlers/submitModularHandler.pyx b/handlers/submitModularHandler.pyx index 85a1fc3..bf2b855 100644 --- a/handlers/submitModularHandler.pyx +++ b/handlers/submitModularHandler.pyx @@ -238,9 +238,10 @@ class handler(requestsManager.asyncRequestHandler): 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: - flagsReadable = generalUtils.calculateFlags(haxFlags, used_mods, s.gameMode) - 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") + flagsReadable = generalUtils.calculateFlags(int(haxFlags), used_mods, s.gameMode) + if len(flagsReadable) > 1: + 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: userUtils.ban(userID)