From c6a63f5c141c5f144434e556fcf296be4240e7f9 Mon Sep 17 00:00:00 2001 From: neptune Date: Fri, 26 Mar 2021 17:39:29 -0300 Subject: Update --- cgi/framework.py | 9 +- cgi/post.py | 40 +- cgi/proxy.txt | 3 +- cgi/templates/home.html | 13 +- cgi/templates/mobile/latest.html | 11 +- cgi/templates/navbar.html | 1 - cgi/templates/txt_base_top.html | 3 +- cgi/templates/txt_board.html | 4 +- cgi/tor.txt | 2837 +++++++++++++++++++++++--------------- cgi/weabot.py | 25 +- static/css/dickgirl.css | 1 - static/css/ib.css | 5 +- static/css/txt/sjis.css | 3 +- static/css/txt/vipper.css | 2 + static/ico/madotsuki1.gif | Bin 0 -> 2926 bytes 15 files changed, 1798 insertions(+), 1159 deletions(-) create mode 100644 static/css/txt/vipper.css create mode 100644 static/ico/madotsuki1.gif diff --git a/cgi/framework.py b/cgi/framework.py index 83624a8..898d6a1 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -96,7 +96,7 @@ def addressIsProxy(ip): def addressIsES(ip): ES = ['AR', 'BO', 'CL', 'CO', 'CR', 'CU', 'EC', 'ES', 'GF', - 'GY', 'GT', 'HN', 'MX', 'NI', 'PA', 'PE', 'PY', 'PR', 'SR', 'UY', 'VE'] # 'BR', + 'GY', 'GT', 'HN', 'MX', 'NI', 'PA', 'PE', 'PY', 'PR', 'SR', 'UY', 'VE', 'v6'] # 'BR', return getCountry(ip) in ES @@ -105,8 +105,11 @@ def addressIsBannedCountry(ip): def getCountry(ip): - import geoip - return geoip.country(ip) + if ":" in ip: + return "v6" + else: + import geoip + return geoip.country(ip) def getHost(ip): diff --git a/cgi/post.py b/cgi/post.py index 6fc4bac..f40537d 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -985,9 +985,9 @@ def cut_home_msg(message, boardlength=0): short_message = re.compile(r"&(.(?!;))*$", re.DOTALL | re.IGNORECASE).sub("", short_message) # Removes incomplete HTML return short_message -def getLastAge(limit): +def getLastAge(board_type, limit): threads = [] - sql = "SELECT posts.id, boards.name AS board_fulln, boards.subname AS board_name, board_type, boards.dir, timestamp, bumped, last, length, thumb, CASE WHEN posts.subject = boards.subject THEN posts.message ELSE posts.subject END AS content FROM posts INNER JOIN boards ON boardid = boards.id WHERE parentid = 0 AND IS_DELETED = 0 AND boards.secret = 0 AND posts.locked < 3 ORDER BY bumped DESC LIMIT %d" % limit + sql = "SELECT posts.id, boards.name AS board_fulln, boards.subname AS board_name, board_type, boards.dir, timestamp, bumped, last, length, thumb, CASE WHEN posts.subject = boards.subject THEN posts.message ELSE posts.subject END AS content FROM posts INNER JOIN boards ON boardid = boards.id WHERE parentid = 0 AND IS_DELETED = 0 AND boards.secret = 0 AND posts.locked < 3 AND boards.board_type = %d ORDER BY bumped DESC LIMIT %d" % (board_type, limit) threads = FetchAll(sql) for post in threads: @@ -1037,7 +1037,8 @@ def regenerateHome(): 'header': Settings.SITE_TITLE, 'slogan': Settings.SITE_SLOGAN, 'latest_news': FetchAll("SELECT `timestamp`, `message`, `timestamp_formatted` FROM `news` WHERE `type` = '2' ORDER BY `timestamp` DESC LIMIT " + str(Settings.HOME_NEWS)), - 'latest_age': getLastAge(limit), + 'latest_age_ib': getLastAge(0, limit), + 'latest_age_bbs': getLastAge(1, limit), 'latest_age_num': limit, 'new_threads': getNewThreads(Settings.HOME_NEWTHREADS), } @@ -1259,26 +1260,23 @@ def discord_hook(post, url): board = Settings._.BOARD - WEBHOOK_URL = "https://discordapp.com/api/webhooks/428025764974166018/msYu1-R3JRnG-cxrhAu3J7LbIPvzpBlJwbW5PFe5VEQaxVzjros9CXOpjZDahUE42Jgn" - - data = {"content": "", - "ts": post['timestamp'], - "embeds": [{ - "title": post['subject'], - "description": cut_home_msg(post['message'], 30), - "url": "https://bienvenidoainternet.org" + url, # TODO: Parametrizar. - "color": 11910504, - "timestamp": datetime.datetime.utcfromtimestamp(post['timestamp']).isoformat(), - "footer": { "text": board['name'] }, - "thumbnail": { "url": "%s%s/thumb/%s" % (Settings.HOME_URL, board['dir'], post['thumb']) }, - "author": { - "name": "Nuevo hilo", - "icon_url": "%s0/junk/w/shobon.gif" % Settings.HOME_URL - }}] - } + #data = {"embeds": [{ + # "title": post['subject'], + # "description": cut_home_msg(post['message'], 30), + # "url": "https://bienvenidoainternet.org" + url, # TODO: Parametrizar. + # "color": 11910504, + # "timestamp": datetime.datetime.utcfromtimestamp(post['timestamp']).isoformat(), + # "footer": { "text": board['name'] }, + # "thumbnail": { "url": "%s%s/thumb/%s" % (Settings.HOME_URL, board['dir'], post['thumb']) }, + # "author": { + # "name": "Nuevo hilo", + # "icon_url": "%s0/junk/w/shobon.gif" % Settings.HOME_URL + # }}] + #} + data = {"content": "test"} jsondata = json.dumps(data, separators=(',',':')) opener = urllib2.build_opener() - opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0')] + #opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0')] response = opener.open(Settings.DISCORD_HOOK_URL, jsondata, 6) the_page = response.read() diff --git a/cgi/proxy.txt b/cgi/proxy.txt index 5fc9460..4131207 100644 --- a/cgi/proxy.txt +++ b/cgi/proxy.txt @@ -1,3 +1,4 @@ +31.220.1.170 190.151.94.45 186.67.46.229 109.107.112.139 @@ -3248,4 +3249,4 @@ 82.145.149.5 217.11.47.9 179.43.144.19 -177.154.139.196 \ No newline at end of file +177.154.139.196 diff --git a/cgi/templates/home.html b/cgi/templates/home.html index ffd9c4e..fb06465 100644 --- a/cgi/templates/home.html +++ b/cgi/templates/home.html @@ -7,7 +7,7 @@