From c00e0f9f07827630ccba2cf4ac8bf0793d0ba930 Mon Sep 17 00:00:00 2001
From: Choom
Date: Mon, 23 Jan 2023 18:09:26 -0300
Subject: Separando .trip de .name
---
cgi/manage.py | 50 ++++++++++++++++++++++++++++++++---------
cgi/templates/board.0.html | 8 +++----
cgi/templates/board.html | 26 +++++++++++----------
cgi/templates/board.jp.html | 26 +++++++++++----------
cgi/templates/txt_archive.html | 8 +++----
cgi/templates/txt_board.en.html | 8 +++----
cgi/templates/txt_board.html | 8 +++----
cgi/templates/txt_thread.html | 11 ++++-----
cgi/weabot.py | 7 ------
9 files changed, 90 insertions(+), 62 deletions(-)
(limited to 'cgi')
diff --git a/cgi/manage.py b/cgi/manage.py
index e3d7704..cd1a215 100644
--- a/cgi/manage.py
+++ b/cgi/manage.py
@@ -1398,10 +1398,12 @@ def manage(self, path_split):
if not administrator:
return
+ return
+
board = setBoard(path_split[3])
- threads = FetchAll(
- 'SELECT * FROM archive WHERE boardid = %s ORDER BY timestamp DESC' % board['id'])
+ threads = FetchAll('SELECT * FROM archive WHERE boardid = %s ORDER BY timestamp DESC' % board['id'])
+
for item in threads:
t = time.time()
self.output += str(item['timestamp']) + '
'
@@ -1410,22 +1412,50 @@ def manage(self, path_split):
str(item["timestamp"]) + ".json"
if os.path.isfile(fname):
import json
+
with open(fname) as f:
thread = json.load(f)
- thread['posts'] = [
- dict(list(zip(thread['keys'], row))) for row in thread['posts']]
- template_fname = "txt_archive.html"
-
- post_preview = cut_home_msg(
- thread['posts'][0]['message'], 0)
- page = renderTemplate("txt_archive.html", {"threads": [
- thread], "preview": post_preview}, False)
+
+ #thread['posts'] = [dict(list(zip(thread['keys'], row))) for row in thread['posts']]
+
+ #if 'posterid' not in thread['keys']:
+ # for post in thread['posts']:
+ # half = post['timestamp_formatted'].split(' ID:')
+ # if len(half) > 1:
+ # post['timestamp_formatted'] = half[0]
+ # post['posterid'] = half[1]
+ # else:
+ # post['posterid'] = ''
+ #
+ # thread['keys'].append('posterid')
+
+ #if 'message' not in thread:
+ # thread['message'] = thread['posts'][0]['message']
+ # thread['keys'].append('message')
+
+ #thread['posts'] = [[row[key] for key in thread['keys']] for row in thread['posts']]
+
+ ##raise UserError(thread)
+
+ #try:
+ # with open(fname, "w") as f:
+ # json.dump(thread, f, indent=0)
+ #except:
+ # raise UserError("Can't edit")
+
+ thread['posts'] = [dict(list(zip(thread['keys'], row))) for row in thread['posts']]
+
+ post_preview = cut_msg(thread['message'], 0)
+
+ page = renderTemplate("txt_archive.html", {"threads": [thread], "preview": post_preview}, False)
+
with open(Settings.ROOT_DIR + board["dir"] + "/kako/" + str(thread['timestamp']) + ".html", "w") as f:
f.write(page)
self.output += 'done' + str(time.time() - t) + '
'
else:
self.output += 'El hilo no existe.
'
+
elif path_split[2] == 'fixexpires':
if not administrator:
return
diff --git a/cgi/templates/board.0.html b/cgi/templates/board.0.html
index 51bfe71..5be1e28 100644
--- a/cgi/templates/board.0.html
+++ b/cgi/templates/board.0.html
@@ -13,7 +13,7 @@