aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuestion Box Service <qbox@andrewyu.org>2023-04-08 04:24:07 +0200
committerQuestion Box Service <qbox@andrewyu.org>2023-04-08 04:24:07 +0200
commita815834345eebd4d1498222028989db1a2bcca43 (patch)
tree043c8ef3db9eebe21a1813ca156f8aa5e0cc99c3
parent8772395b33a82d8eeeb5600d44e10ee14e2cdd43 (diff)
downloadqbox-a815834345eebd4d1498222028989db1a2bcca43.tar.gz
qbox-a815834345eebd4d1498222028989db1a2bcca43.zip
Cleanup and modify homepage to include user guide
-rwxr-xr-xapp.py13
-rw-r--r--templates/home.html43
2 files changed, 45 insertions, 11 deletions
diff --git a/app.py b/app.py
index 4394d23..29fadd5 100755
--- a/app.py
+++ b/app.py
@@ -72,11 +72,9 @@ def generate_user_list_from_mapping(mapping):
generated_user_list += username
generated_user_list += "\">"
generated_user_list += usertuple[3]
- generated_user_list += "</a> [Email: <a href=\"mailto:"
- generated_user_list += usertuple[0]
- generated_user_list += "\">"
- generated_user_list += usertuple[0]
- generated_user_list += "</a>, homepage: <a href=\""
+ generated_user_list += "</a> [Email: "
+ generated_user_list += usertuple[0].replace("@", " <i>at</i> ").replace(".", " <i>dot</i> ")
+ generated_user_list += ", homepage: <a href=\""
generated_user_list += usertuple[2]
generated_user_list += "\">"
generated_user_list += usertuple[2]
@@ -146,11 +144,9 @@ def qboard(user):
mbox = mailbox.Maildir('/home/qbox/Mail/Inbox')
for msg_id, msg in mbox.items():
if msg.get_subdir() != "new": continue
- print(f'{msg.get_subdir()=}')
mbox.lock()
msg.add_flag("SR")
msg.set_subdir("cur") # apparently it's not doing so
- print(f'{msg.get_subdir()=} should be cur')
mbox[msg_id] = msg
mbox.flush()
mbox.unlock()
@@ -177,7 +173,6 @@ def qboard(user):
p.communicate(newmsg.as_bytes())
return # This return was missing
- print(msg["In-Reply-To"])
reply_identifier = parse_address(str(msg['In-Reply-To']))[1] # Should be ts
for question in reversed(db):
if reply_identifier == "qbox-" + question["ts"]:
@@ -277,7 +272,6 @@ def qboard(user):
db = load_database(user)
db.append({"q": text, "a": None, "ts": ts})
dump_database(user, db)
- print(repr(text) + "\a")
msg = MIMEText(
f"Hello {MAPPING[user][3]},\n\nThe following message was received in your ({user}'s) question box at server timestamp {ts}. Please reply to this in plain text email, as in the MIME type should be ``text/plain''; you may handwrite HTML in your reply; newlines will be automatically converted to ``<br />''s. Alternatively, HTML email will be accepted but are not recommended. Remember to remove any quoted text if your email client adds these automatically. Attachments will be ignored.\n\n{text}\n\nQuestion Box System"
)
@@ -306,5 +300,6 @@ def index():
)
+
if __name__ == "__main__":
app.run(port=5728)
diff --git a/templates/home.html b/templates/home.html
index bba7e4e..1dd1320 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -9,12 +9,51 @@
<body>
<h1>Question Boards on <code>andrewyu.org</code></h1>
- <strong style="color: red; font-size: 300%;">Site under maintainance — very unstable!!!</strong>
-
+ <p>
+ The following is a list of users on this question board server. Click their name to access their particular question board.
+ </p>
<ul>
{{userlist}}
</ul>
+ <details>
+ <summary>
+ Quick guide for question board owners
+ </summary>
+ <p>
+ This quick guide is written for question board owners, i.e. people listed above.
+ </p>
+ <p>
+ When a guest submits a message through the Web interface, qbox sends you an email through your registered email address that includes the guest's original message.
+ </p>
+ <p>
+ If you want to reply to the guest's message, simply reply to the notification email. However, here are a few points to remember:
+ </p>
+ <ul>
+ <li>
+ It must be actually a <em>reply</em> to the notification email. That is, your reply's <code>In-Reply-To</code> header must match the <code>Message-ID</code> header in the notification email. In most clients, using the ``reply'' button should set this header correctly automatically.
+ </li>
+ <li>
+ Plain text replies of MIME type <code>text/plain<code> are preferred and are prioritized in <code>multipart/alternative</code>s. You may hand-write HTML segments in your plain email. All line breaks in the plain text email will be replaced with <code>&lt;br /&gt;</code> when added to the server's database.
+ </li>
+ <li>
+ HTML replies of MIME type <code>text/html</code> are accepted when no <code>text/plain</code> is found, as a last resort. The entirety of the HTML email is included in the database and thus the final Web page, which means that many tags and such will likely be messed up as we're directly including complete HTML code inside an HTML page. Therefore, it is not recommended to be using HTML replies.
+ </li>
+ <li>
+ If you want to modify one of your past replies, find the original notification email that inclues the guest's original message, and reply to that email. Do not reply to ``I received your reply'' notifications or your own emails.
+ </li>
+ <li>
+ Many email clients would automatically include the original message, in quoted format, when writing replies. Remember to remove the quoted text—ensure that your reply include and only includes your own reply text.
+ </li>
+ <li>
+ When your email is processed, you will receive a reply to your reply that says ``I have received your message and I added it to the question board.''. DO note, however, that email processing is lazy and only happens when someone visits your question board Webpage, so these replies may be delayed by a bit.
+ </li>
+ </ul>
+ <p>
+ Please contact the site administrator or <a href="https://www.andrewyu.org/contact.html">the developer</a> if you have any questions, problems, suggestions, etc.
+ </p>
+ </details>
+
<div id="footer">
<hr />
<p>