crabmail

Static HTML email archive viewer in Rust
git clone git://git.alexwennerberg.com/crabmail
Log | Files | Refs | README | LICENSE

commit a7b5be407af9ae61122ea2b264b513a80f5e612b
parent b1a9c80299d9bebce649f9041e7461ed1be2faca
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 27 Mar 2022 11:51:06 -0700

cleanup

Diffstat:
MTODO | 4+++-
Msrc/main.rs | 5++++-
Msrc/templates/html.rs | 8+++-----
Msrc/templates/xml.rs | 2+-
4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/TODO b/TODO @@ -1,6 +1,8 @@ TODO ==== -qa atom +atom get item href working on list +fix bottom anchor + check for html escape bugz Duplicate ID verification: warn on duplicate ID, use first received-date. This is to prevent someone overwriting old emails secretly diff --git a/src/main.rs b/src/main.rs @@ -153,7 +153,10 @@ impl List { self.thread_topics.sort_by_key(|t| t.last_reply); self.thread_topics.reverse(); self.recent_messages = self.get_recent_messages(); - + for msg in &mut self.recent_messages { + // TBD + // msg.set_url(&self, &summary); // awkward) // hacky + } // Remove deleted stuff for dir in vec![message_dir, thread_dir] { for entry in fs::read_dir(&dir).unwrap() { diff --git a/src/templates/html.rs b/src/templates/html.rs @@ -124,10 +124,7 @@ impl List { HEADER, r#" <h1 class="page-title"> - {title} - <a href="atom.xml"> - <img alt="Atom feed" src='{rss_svg}' /> - </a> + {title}<a href="atom.xml"><img alt="Atom feed" src='{rss_svg}' /></a> </h1> {description}<br> <a href="{mailto:list_email}">{list_email}</a> @@ -175,8 +172,9 @@ impl Thread { pub fn to_html(&self) -> String { let root = &self.messages[0]; let body = r#" - <h1 class="page-title">{title}</h1> + <h1 class="page-title">{title} <a href="{path_id}.xml"><img alt="Atom Feed" src='{rss_svg}'></a> + </h1> <div> <a href="../">Back</a> <a href='#bottom'>Latest</a> diff --git a/src/templates/xml.rs b/src/templates/xml.rs @@ -21,7 +21,7 @@ const FEED_TEMPLATE: &str = r#"<?xml version="1.0" encoding="utf-8"?> const MESSAGE_TEMPLATE: &str = r#"<entry> <title>{title}</title> -<link href="tbd"/> +<link href="{item_link}"/> <id>{entry_id}</id> <updated>{updated_at}</updated> <author>