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 @@
respondanta reĝimo
-
+
@@ -63,7 +63,7 @@ - + @@ -72,7 +72,7 @@ komerco - + @@ -115,7 +115,7 @@
  • unuafoje? kiel uzi · oftaj demandoj · burokratio
  • konekti vian estaĵo, ŝlosita en ekziston.
  • -
    + diff --git a/cgi/templates/board.html b/cgi/templates/board.html index d0e001a..6254bd5 100644 --- a/cgi/templates/board.html +++ b/cgi/templates/board.html @@ -14,7 +14,7 @@
    Modo Respuesta
    -
    +
    @@ -64,7 +64,7 @@ - + @@ -73,7 +73,7 @@ Asunto - + @@ -116,7 +116,7 @@
  • Los hilos son automáticamente eliminados a los #{maxage} días de edad.
  • ¿Eres nuevo? Leer antes de postear · Preguntas frecuentes · Contacto
  • -
    + @@ -178,15 +178,17 @@ - - #{post['name']} - #{post['tripcode'] if post['tripcode'] else ''} - + + + + + - - #{post['name']} - #{post['tripcode'] if post['tripcode'] else ''} - + + #{post['name']} #{post['tripcode']} + + #{post['name']} + #{post['timestamp_formatted']} diff --git a/cgi/templates/board.jp.html b/cgi/templates/board.jp.html index 372141d..5ce2017 100644 --- a/cgi/templates/board.jp.html +++ b/cgi/templates/board.jp.html @@ -14,7 +14,7 @@
    レス送信モード
    -
    +
    @@ -66,7 +66,7 @@ - + @@ -75,7 +75,7 @@ 題  名 - + @@ -118,7 +118,7 @@
  • スレは#{maxage}日間経つと自動的に消されられます.
  • 使い方 · よくある質問 · 管理人への連絡
  • -
    + @@ -180,15 +180,17 @@ - Name - #{post['name']} - #{post['tripcode'] if post['tripcode'] else ''} - + + Name + + Name + - Name - #{post['name']} - #{post['tripcode'] if post['tripcode'] else ''} - + + Name #{post['name']} #{post['tripcode']} + + Name #{post['name']} + #{post['timestamp_formatted']} diff --git a/cgi/templates/txt_archive.html b/cgi/templates/txt_archive.html index 2526f44..fe7f8c6 100644 --- a/cgi/templates/txt_archive.html +++ b/cgi/templates/txt_archive.html @@ -54,15 +54,15 @@

    #{post['num']} : - #{post['name']} #{post['tripcode']} + - #{post['name']} + - #{post['name']} #{post['tripcode']} + #{post['name']} #{post['tripcode']} - #{post['name']} + #{post['name']} : #{post['timestamp_formatted']} diff --git a/cgi/templates/txt_board.en.html b/cgi/templates/txt_board.en.html index 16fe616..567ef8e 100644 --- a/cgi/templates/txt_board.en.html +++ b/cgi/templates/txt_board.en.html @@ -52,15 +52,15 @@

    #{post['num']} : - #{post['name']} #{post['tripcode']} + - #{post['name']} + - #{post['name']} #{post['tripcode']} + #{post['name']} #{post['tripcode']} - #{post['name']} + #{post['name']} : #{post['timestamp_formatted']} diff --git a/cgi/templates/txt_board.html b/cgi/templates/txt_board.html index 8d01490..843625a 100644 --- a/cgi/templates/txt_board.html +++ b/cgi/templates/txt_board.html @@ -56,15 +56,15 @@

    #{post['num']} : - #{post['name']} #{post['tripcode']} + - #{post['name']} + - #{post['name']} #{post['tripcode']} + #{post['name']} #{post['tripcode']} - #{post['name']} + #{post['name']} : #{post['timestamp_formatted']} diff --git a/cgi/templates/txt_thread.html b/cgi/templates/txt_thread.html index ad1bce6..8375d27 100644 --- a/cgi/templates/txt_thread.html +++ b/cgi/templates/txt_thread.html @@ -38,17 +38,18 @@

    #{post['num']} : - #{post['name']} #{post['tripcode']} + - #{post['name']} + - #{post['name']} #{post['tripcode']} + #{post['name']} #{post['tripcode']} - #{post['name']} + #{post['name']} - : #{post['timestamp_formatted']} + + : #{post['timestamp_formatted']} ID:#{post['posterid']} diff --git a/cgi/weabot.py b/cgi/weabot.py index eaf4477..167fee6 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -382,13 +382,6 @@ class weabot(object): except Exception as messagez: self.output = "Error: " + \ str(messagez) + " : " + str(self.formdata) - elif path_split[1] == "mod": - import modapi - caught = True - self.headers = [("Content-Type", "application/json"), ("Access-Control-Allow-Origin", "*"), ("Access-Control-Allow-Methods", - "PUT, GET, POST, DELETE, OPTIONS"), ("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With")] - OpenDb() - modapi.api(self, path_split) if not caught: # Redirect the user back to the front page self.output += '

    --> --> -->

    ' % Settings.HOME_URL -- cgit v1.2.1-18-gbd029