From d91ff2e857cb697b69812de017a32032b2ac0db9 Mon Sep 17 00:00:00 2001 From: junk Date: Wed, 28 Apr 2021 17:45:05 -0400 Subject: Prohibido Tor (2) --- cgi/formatting.py | 5 +++-- cgi/weabot.py | 17 ++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cgi/formatting.py b/cgi/formatting.py index 47922c9..ead1d0f 100644 --- a/cgi/formatting.py +++ b/cgi/formatting.py @@ -47,9 +47,10 @@ def format_post(message, ip, parentid, parent_timestamp=0): # If not using markdown quotes must be created and \n changed for HTML line breaks if not using_markdown: - message = re.compile(r"^(\n)+").sub('', message) - message = checkQuotes(message) + message = re.compile(r"^[\s\t]*(\n)+").sub("", message) + message = re.compile(r"\n(\n)+").sub("

", message) message = message.replace("\n", "
") + message = checkQuotes(message) return message diff --git a/cgi/weabot.py b/cgi/weabot.py index a54fd2b..194339f 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -405,8 +405,6 @@ class weabot(object): if hostIsBanned(ip): raise UserError, "Sufijo de host en lista negra." - if addressIsTor(ip): - raise UserError, "Proxy prohibido." # open database OpenDb() @@ -414,9 +412,9 @@ class weabot(object): # set the board board = setBoard(boarddir) - if board["dir"] not in ["world"]: - if addressIsProxy(ip) or addressIsBannedCountry(ip) or not addressIsES(ip): - raise UserError, "Proxy prohibido en esta sección." + if board["dir"] not in Settings.EXCLUDE_GLOBAL_BANS: + if addressIsTor(ip) or addressIsProxy(ip) or addressIsBannedCountry(ip) or not addressIsES(ip): + raise UserError, "Proxy prohibido." # check length of fields if len(name) > 50: @@ -438,8 +436,7 @@ class weabot(object): t = time.time() # Delete expired bans - deletedBans = UpdateDb( - "DELETE FROM `bans` WHERE `until` != 0 AND `until` < " + str(timestamp())) + deletedBans = UpdateDb("DELETE FROM `bans` WHERE `until` != 0 AND `until` < " + str(timestamp())) if deletedBans > 0: regenerateAccess() @@ -449,8 +446,7 @@ class weabot(object): # Disallow posting if the site OR board is in maintenance if Settings.MAINTENANCE and board["dir"] != 'polka': - raise UserError, _( - "%s is currently under maintenance. We'll be back.") % Settings.SITE_TITLE + raise UserError, _("%s is currently under maintenance. We'll be back.") % Settings.SITE_TITLE if board["locked"] == '1': raise UserError, _("This board is closed. You can't post in it.") @@ -469,8 +465,7 @@ class weabot(object): post["parentid"] = parent_post['id'] post["bumped"] = parent_post['bumped'] if parent_post['locked'] == '1': - raise UserError, _( - "The thread is closed. You can't post in it.") + raise UserError, _("The thread is closed. You can't post in it.") # check if the user is flooding flood_check(t, post, board["id"]) -- cgit v1.2.1-18-gbd029