Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: myr (myr@terminal.pink)
Date: Wed Mar 5 12:41:35 2025 -0300
Parent: f3ca369
Adjusted dovel hook
diff --git a/receive-dovel.email b/receive-dovel.email
index 700c140..42a98fc 100755
--- a/receive-dovel.email
+++ b/receive-dovel.email
@@ -30,7 +30,7 @@ inbox() {
<h2>Mail</h2>
EOF
- ls -ogdt --time-style long-iso "$root/mail/"* | while read -r g x s d t f
+ ls -ogdt --time-style long-iso "$root/mail/"* | rev | while read -r g x s d t f
do
[ -d "$f" ] || continue
f="$(basename "$f")"
@@ -52,11 +52,11 @@ inbox() {
emails() {
cat <<- EOF
$(pagehead dovel)
- <h2>$(echo "$subj" | base64 -d)</h2>
+ <h2>$subj</h2>
EOF
# print each email
- ls -1rt "$root/mail/$subj/"*.mbox | while read -r f
+ ls -1rt "$root/mail/$dir/"*.mbox | while read -r f
do
{
# print headers
@@ -114,7 +114,8 @@ save() {
done
eid="${eid:-$(date -Iseconds)}"
echo "email from $from to $to about $subj"
- dir="$(echo "$to:$subj" | base64)"
+ subj="$(decode "$subj" | escapehtml)"
+ dir="$(echo "$subj" | base64)"
# now the rest is a body
cat - > /dev/null
@@ -127,12 +128,12 @@ save() {
# create html pages
echo "creating html pages"
inbox > "$root/mail.html"
- emails > "$root/mail/$subj.html"
+ emails > "$root/mail/$dir.html"
}
root="$HOME/dovel.email"
# copy to temp file
tmp="$(mktemp)"
-tee "$tmp" | save
+tee "$tmp" -a "$HOME/mail.mbox" | save