crabmail

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

commit 0947f156a44ac143c6934e2ace29555628c38340
parent 2b9e458e3c550e22927d30794e4a3de0c50376ed
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 10 Jan 2022 09:15:55 -0800

start config work, fix minor bug

Diffstat:
Mcrabmail.conf | 2++
Msrc/config.rs | 9+++++++++
Msrc/main.rs | 2+-
3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/crabmail.conf b/crabmail.conf @@ -1,3 +1,5 @@ # Use %s to represent list name email_fmt=lists+%s@flounder.online base_url=https://lists.flounder.online + +[somelist] diff --git a/src/config.rs b/src/config.rs @@ -15,6 +15,13 @@ pub struct Config { pub now: String, } +pub struct Subsection { + pub name: String, + pub title: String, // "something mailing list" + pub email: String, + pub description: String, // urls allowed +} + pub static INSTANCE: OnceCell<Config> = OnceCell::new(); impl Config { @@ -24,11 +31,13 @@ impl Config { pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Config, std::io::Error> { let file = File::open(path)?; + // let sub_sections = vec![]; let mut email_fmt = "lists+%s@example.com".to_string(); let mut base_url = "https://example.com".to_string(); for l in io::BufReader::new(file).lines() { let line = l?; + if line.starts_with("[") && line.ends_with("]") {} if line.len() == 0 { continue; } diff --git a/src/main.rs b/src/main.rs @@ -118,8 +118,8 @@ impl<'a> ThreadList<'a> { } let l = &entries.len(); let last_updated = match l { - _ => entries[0].0, 0 => 0, + _ => entries[0].0, }; let atom = format!( r#"<?xml version="1.0" encoding="utf-8"?>