(Post muy largo... Presiona aquí para verlo completo.)+
(Post muy largo... Presiona aquí para verlo completo.)@@ -227,4 +227,4 @@
...
' % url elif path_split[1] == "nostalgia": caught = True OpenDb() thread = FetchOne( "SELECT `timestamp` FROM `archive` WHERE `boardid` = 9 AND `timestamp` < 1462937230 ORDER BY RAND() LIMIT 1") - url = Settings.HOME_URL + '/zonavip/read/' + \ - thread['timestamp'] + '/' + url = f"{Settings.HOME_URL}/zonavip/read/{thread['timestamp']}/" self.output += '...
' % url elif path_split[1] == "banned": OpenDb() @@ -404,9 +401,20 @@ class weabot(object): _STARTTIME = time.process_time() # Comment if not debug if Settings.PROXY_BANS and ip not in Settings.PROXY_WHITELIST and (boarddir not in Settings.EXCLUDE_GLOBAL_BANS): - if addressIsTor(ip) or addressIsProxy(ip) or addressIsBannedCountry(ip) or not addressIsES(ip): + if addressIsTor(ip): + logging.warn("Proxy: Tor %s" % ip) + raise UserError("Proxy prohibido.") + if addressIsProxy(ip): + logging.warn("Proxy: Proxy %s" % ip) + raise UserError("Proxy prohibido.") + if addressIsBannedCountry(ip): + logging.warn("Proxy: Banned country %s" % ip) + raise UserError("Proxy prohibido.") + if not addressIsES(ip): + logging.warn("Proxy: Not ES %s" % ip) raise UserError("Proxy prohibido.") if hostIsBanned(ip): + logging.warn("Proxy: Blacklisted host %s" % ip) raise UserError("Sufijo de host en lista negra.") # open database @@ -595,7 +603,7 @@ class weabot(object): self.environ["HTTP_USER_AGENT"], cap_id, hide_end, (board["countrycode"] in [1, 2])) # use for future file checks - xfile = (file is not None or oek_file) + xfile = (file or oek_file) # textboard inforcements (change it to settings maybe?) if board['board_type'] == 1: @@ -640,7 +648,7 @@ class weabot(object): if file and not noimage: post = processImage(post, file, t, file_original, - (spoil and board['allow_spoilers'] == '1')) + (spoil and board['allow_spoilers'])) if oek_file: # Remove temporary oekaki file if everything went right @@ -652,11 +660,11 @@ class weabot(object): pass # Just keep it if anything went wrong # slip - if board["slip"] != '0': + if board["slip"]: slips = [] # name - if board["slip"] in ['1', '3']: + if board["slip"] in [1, 3]: if time.strftime("%H") in ['00', '24'] and time.strftime("%M") == '00' and time.strftime("%S") == '00': host_nick = '000000' else: @@ -762,15 +770,15 @@ class weabot(object): post["name"] += " [%s]" % country # set expiration date if necessary - if board["maxage"] != 0 and not post["parentid"]: + if board["maxage"] > 0 and not post["parentid"]: if board["dir"] == '2d': date_format = '%m月%d日' date_format_y = '%Y年%m月' else: date_format = '%d/%m' date_format_y = '%m/%Y' - post["expires"] = int(t) + (int(board["maxage"]) * 86400) - if int(board["maxage"]) >= 365: + post["expires"] = int(t) + (board["maxage"] * 86400) + if board["maxage"] >= 365: date_format = date_format_y post["expires_formatted"] = datetime.datetime.fromtimestamp( post["expires"]).strftime(date_format) @@ -959,7 +967,7 @@ class weabot(object): raise UserError(_("Post doesn't exist.")) # generate link - if board["board_type"] == '1': + if board["board_type"] == 1: parent_post = get_parent_post(post["parentid"], board["id"]) link = "/%s/read/%s/%s" % (board["dir"], parent_post["timestamp"], postshow) -- cgit v1.2.1-18-gbd029