aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar Choom 2023-01-23 18:09:26 -0300
committerLibravatar Choom 2023-01-24 09:51:42 -0300
commitc00e0f9f07827630ccba2cf4ac8bf0793d0ba930 (patch)
tree31e6af72056a8369b2d25b50009bcb7a072d5682 /cgi
parent9bd8d1e527cf90ef8033b8455a96e5caf92f02bd (diff)
downloadweabot-c00e0f9f07827630ccba2cf4ac8bf0793d0ba930.tar.gz
weabot-c00e0f9f07827630ccba2cf4ac8bf0793d0ba930.tar.xz
weabot-c00e0f9f07827630ccba2cf4ac8bf0793d0ba930.zip
Separando .trip de .name
Diffstat (limited to 'cgi')
-rw-r--r--cgi/manage.py50
-rw-r--r--cgi/templates/board.0.html8
-rw-r--r--cgi/templates/board.html26
-rw-r--r--cgi/templates/board.jp.html26
-rw-r--r--cgi/templates/txt_archive.html8
-rw-r--r--cgi/templates/txt_board.en.html8
-rw-r--r--cgi/templates/txt_board.html8
-rw-r--r--cgi/templates/txt_thread.html11
-rwxr-xr-xcgi/weabot.py7
9 files changed, 90 insertions, 62 deletions
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']) + '<br />'
@@ -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) + '<br />'
else:
self.output += 'El hilo no existe.<br />'
+
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 @@
<div class="replymode">respondanta reĝimo</div>
<?py #endif ?>
<a name="postbox"></a>
-<div class="postarea">
+<div id="postarea">
<?py if allow_oekaki and not oek_finish: ?>
<center>
<form id="oekform" action="#{cgi_url}oekaki/paint" method="post" enctype="multipart/form-data">
@@ -63,7 +63,7 @@
<td>
<input type="text" name="fieldb" size="25" accesskey="e" />
<?py if disable_subject: ?>
- <input type="submit" value="#{'konekti' if replythread else 'tusxu la mondo'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'konekti' if replythread else 'tusxu la mondo'}" accesskey="z" />
<?py #endif ?>
</td>
</tr>
@@ -72,7 +72,7 @@
<td class="postblock">komerco</td>
<td>
<input type="text" name="subject" size="35" maxlength="100" accesskey="s" />
- <input type="submit" value="#{'konekti' if replythread else 'tusxu la mondo'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'konekti' if replythread else 'tusxu la mondo'}" accesskey="z" />
</td>
</tr>
<?py #endif ?>
@@ -115,7 +115,7 @@
<?py #endif ?>
<li>unuafoje? <a href="/guia.html" target="_blank">kiel uzi</a> · <a href="/faq.html" target="_blank">oftaj demandoj</a> · <a href="/bai/" target="_blank">burokratio</a></li>
<li>konekti vian estaĵo, ŝlosita <a href="mailto:burocracia@bienvenidoainternet.org">en ekziston</a>.</li>
- <li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">foliumi: </label><input type="text" name="q" id="searchin" value="" size="10"> <input type="submit" value="iru"></form></li>
+ <li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">foliumi: </label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="iru"></form></li>
</ul>
</td>
</tr>
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 @@
<div class="replymode">Modo Respuesta</div>
<?py #endif ?>
<a name="postbox"></a>
-<div class="postarea">
+<div id="postarea">
<?py if allow_oekaki and not oek_finish: ?>
<center>
<form id="oekform" action="#{cgi_url}oekaki/paint" method="post" enctype="multipart/form-data">
@@ -64,7 +64,7 @@
<td>
<input type="text" name="fieldb" size="25" accesskey="e" />
<?py if disable_subject: ?>
- <input type="submit" value="#{'Responder' if replythread else 'Crear hilo'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'Responder' if replythread else 'Crear hilo'}" accesskey="z" />
<?py #endif ?>
</td>
</tr>
@@ -73,7 +73,7 @@
<td class="postblock">Asunto</td>
<td>
<input type="text" name="subject" size="35" maxlength="100" accesskey="s" />
- <input type="submit" value="#{'Responder' if replythread else 'Crear hilo'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'Responder' if replythread else 'Crear hilo'}" accesskey="z" />
</td>
</tr>
<?py #endif ?>
@@ -116,7 +116,7 @@
<li>Los hilos son automáticamente eliminados a los <b>#{maxage}</b> días de edad.</li>
<?py #endif ?>
<li>¿Eres nuevo? <a href="/guia.html" target="_blank">Leer antes de postear</a> · <a href="/faq.html" target="_blank">Preguntas frecuentes</a> · <a href="/bai/" target="_blank">Contacto</a></li>
- <li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">Buscar: </label><input type="text" name="q" id="searchin" value="" size="10"> <input type="submit" value="Ir"></form></li>
+ <li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">Buscar: </label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="Ir"></form></li>
</ul>
</td>
</tr>
@@ -178,15 +178,17 @@
<?py #endif ?>
</label>
<?py if post['email']: ?>
- <a href="mailto:#{post['email']}"><span class="name">
- <b>#{post['name']}</b>
- #{post['tripcode'] if post['tripcode'] else ''}
- </span></a>
+ <?py if post['tripcode']: ?>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
+ <?py else: ?>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
+ <?py #endif ?>
<?py else: ?>
- <span class="name">
- <b>#{post['name']}</b>
- #{post['tripcode'] if post['tripcode'] else ''}
- </span>
+ <?py if post['tripcode']: ?>
+ <span class="name">#{post['name']} <span class="trip">#{post['tripcode']}</span></span>
+ <?py else: ?>
+ <span class="name">#{post['name']}</span>
+ <?py #endif ?>
<?py #endif ?>
<span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
<?py if post['posterid']: ?>
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 @@
<div class="replymode">レス送信モード</div>
<?py #endif ?>
<a name="postbox"></a>
-<div class="postarea">
+<div id="postarea">
<?py if allow_oekaki and not oek_finish: ?>
<center>
<form id="oekform" action="#{cgi_url}oekaki/paint" method="post" enctype="multipart/form-data">
@@ -66,7 +66,7 @@
<td>
<input type="text" name="fieldb" id="f-mail" size="25" accesskey="e" />
<?py if disable_subject: ?>
- <input type="submit" value="#{'返信' if replythread else 'スレッドを立てる'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'返信' if replythread else 'スレッドを立てる'}" accesskey="z" />
<?py #endif ?>
</td>
</tr>
@@ -75,7 +75,7 @@
<td class="postblock">題  名</td>
<td>
<input type="text" name="subject" id="f-sub" size="35" maxlength="100" accesskey="s" />
- <input type="submit" value="#{'返信' if replythread else 'スレッドを立てる'}" accesskey="z" />
+ <input id="sendbtn" type="submit" value="#{'返信' if replythread else 'スレッドを立てる'}" accesskey="z" />
</td>
</tr>
<?py #endif ?>
@@ -118,7 +118,7 @@
<li>スレは<b>#{maxage}</b>日間経つと自動的に消されられます.</li>
<?py #endif ?>
<li><a href="/guia.html" target="_blank">使い方</a> · <a href="/faq.html" target="_blank">よくある質問</a> · <a href="/bai/" target="_blank">管理人への連絡</a></li>
- <li id="search"><form method="get" action="/tools/search.py" style="display: inline-block;"><input type="hidden" name="board" value="${board}"><label for="searchin">検索:</label><input type="text" name="q" id="searchin" value="" size="10"> <input type="submit" value="GO"></form></li>
+ <li id="search"><form method="get" action="/tools/search.py" style="display: inline-block;"><input type="hidden" name="board" value="${board}"><label for="searchin">検索:</label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="GO"></form></li>
</ul>
</td>
</tr>
@@ -180,15 +180,17 @@
<?py #endif ?>
</label>
<?py if post['email']: ?>
- Name <a href="mailto:#{post['email']}"><span class="name">
- <b>#{post['name']}</b>
- #{post['tripcode'] if post['tripcode'] else ''}
- </span></a>
+ <?py if post['tripcode']: ?>
+ Name <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
+ <?py else: ?>
+ Name <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
+ <?py #endif ?>
<?py else: ?>
- Name <span class="name">
- <b>#{post['name']}</b>
- #{post['tripcode'] if post['tripcode'] else ''}
- </span>
+ <?py if post['tripcode']: ?>
+ Name <span class="name">#{post['name']} <span class="trip">#{post['tripcode']}</span></span>
+ <?py else: ?>
+ Name <span class="name">#{post['name']}</span>
+ <?py #endif ?>
<?py #endif ?>
<span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
<?py if post['posterid']: ?>
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 @@
<h4>#{post['num']} :
<?py if post['email']: ?>
<?py if post['tripcode']: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
<?py else: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b></span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
<?py #endif ?>
<?py else: ?>
<?py if post['tripcode']: ?>
- <span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span>
+ <span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span>
<?py else: ?>
- <span class="name"><b>#{post['name']}</b></span>
+ <span class="name">#{post['name']}</span>
<?py #endif ?>
<?py #endif ?>
: <span class="date">#{post['timestamp_formatted']}</span>
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 @@
<h4>#{post['num']} :
<?py if post['email']: ?>
<?py if post['tripcode']: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
<?py else: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b></span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
<?py #endif ?>
<?py else: ?>
<?py if post['tripcode']: ?>
- <span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span>
+ <span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span>
<?py else: ?>
- <span class="name"><b>#{post['name']}</b></span>
+ <span class="name">#{post['name']}</span>
<?py #endif ?>
<?py #endif ?>
: <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
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 @@
<h4>#{post['num']} :
<?py if post['email']: ?>
<?py if post['tripcode']: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
<?py else: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b></span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
<?py #endif ?>
<?py else: ?>
<?py if post['tripcode']: ?>
- <span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span>
+ <span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span>
<?py else: ?>
- <span class="name"><b>#{post['name']}</b></span>
+ <span class="name">#{post['name']}</span>
<?py #endif ?>
<?py #endif ?>
: <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
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 @@
<h4>#{post['num']} :
<?py if post['email']: ?>
<?py if post['tripcode']: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span></a>
<?py else: ?>
- <a href="mailto:#{post['email']}"><span class="name"><b>#{post['name']}</b></span></a>
+ <a class="email" href="mailto:#{post['email']}"><span class="name">#{post['name']}</span></a>
<?py #endif ?>
<?py else: ?>
<?py if post['tripcode']: ?>
- <span class="name"><b>#{post['name']}</b> #{post['tripcode']}</span>
+ <span class="name">#{post['name']}</span> <span class="trip">#{post['tripcode']}</span>
<?py else: ?>
- <span class="name"><b>#{post['name']}</b></span>
+ <span class="name">#{post['name']}</span>
<?py #endif ?>
- <?py #endif ?> : <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
+ <?py #endif ?>
+ : <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
<?py if post['posterid']: ?>
<span class="hash">ID:#{post['posterid']}</span>
<?py #endif ?>
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 += '<html xmlns="http://www.w3.org/1999/xhtml"><body><meta http-equiv="refresh" content="0;url=%s" /><p>--&gt; --&gt; --&gt;</p></body></html>' % Settings.HOME_URL