crabmail

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

commit d85b511e2e19baf2134906cbdfbd2ab38dea428e
parent 2622eca912df1010de745b73fa2e0dd90c123ab1
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 12 Jan 2022 17:43:38 -0800

fix licensing, update readme

Diffstat:
MREADME.md | 31++++++++++++++++++-------------
Mcrabmail.conf | 1+
Msrc/arg.rs | 14+++++++++++++-
Msrc/config.rs | 14++++++++++++++
Msrc/time.rs | 13++++++++++++-
Msrc/utils.rs | 1+
6 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md @@ -14,29 +14,34 @@ Not implemented yet / designed: EMAIL FOREVER! -## Install and usage +## Installation and usage -(DRAFT) see https://alex.flounder.online/tech/howtolist.gmi for more detail +To use crabmail to host your own archive-first mailing list, check out [Self-hosted Archives-first Mailing Lists in 2022](https://alex.flounder.online/tech/howtolist.gmi) -git clone https://git.alexwennerberg.com/crabmail/ +To install: +``` +git clone git://git.alexwennerberg.com/crabmail/ cd crabmail && cargo install --path . +``` -Copy crabmail.conf and set the variables as needed. +Copy `crabmail.conf` and set the variables as needed. + +Get a maildir folder, for example, via `mbsync`. Crabmail will create sub-lists for each folder inside this maildir. Run crabmail [maildir root] -c [config-file.conf]. -If you want to use an mbox, use https://github.com/leahneukirchen/mblaze to -import it into a maildir. Mblaze also has some tools that you may find -supplementary to crabmail. +For more thorough documentation, run `man doc/crabmail.1`. You can also move +these wherever your docs manmages may live + +If you want to use an mbox file (for example, to mirror another archive), use +[mblaze](https://github.com/leahneukirchen/mblaze) to import it into a maildir. +Mblaze also has some tools that you may find supplementary to crabmail. -Open site/index.html in a web browser +Open `site/index.html` in a web browser -For project discussion and patches, use the Mailing list: -https://lists.flounder.online/crabmail/ +For project discussion and patches, and to see a live example, check out the [crabmail mailing list](https://lists.flounder.online/crabmail/) -Crabmail is AGPLv3 licenses, but I'm happy to release code snippets from this -repo (which reimplements some common Rust functions) in a more permissive -license. Email me! +Crabmail is AGPLv3 licenses, but some files are licensed under 0BSD. See also https://git.causal.agency/bubger/about/ diff --git a/crabmail.conf b/crabmail.conf @@ -1,6 +1,7 @@ base_url=https://lists.flounder.online # Use %s to represent list name email_fmt=lists+%s@flounder.online +description=All my lists # optionally wirte/overwrite config for specific lists [smallweb] diff --git a/src/arg.rs b/src/arg.rs @@ -1,3 +1,15 @@ +// This file is licensed under the terms of 0BSD: +// +// Permission to use, copy, modify, and/or distribute this software for any purpose with or without +// fee is hereby granted. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +// SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. + // Extremely minimalist command line interface, inspired by // [sbase](https://git.suckless.org/sbase/)'s // [arg.h](https://git.suckless.org/sbase/file/arg.h.html) @@ -21,7 +33,7 @@ fn usage() -> ! { "usage: {} [maildir root] FLAGS -r use relative timestamps --R include raw emails +-R include raw emails [ALPHA] ARGS: -c config file (crabmail.conf) diff --git a/src/config.rs b/src/config.rs @@ -1,3 +1,15 @@ +// This file is licensed under the terms of 0BSD: +// +// Permission to use, copy, modify, and/or distribute this software for any purpose with or without +// fee is hereby granted. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +// SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. + use once_cell::sync::OnceCell; use std::fs::File; use std::io::{self, BufRead}; @@ -13,6 +25,7 @@ use std::path::{Path, PathBuf}; pub struct Config { pub email_fmt: String, pub base_url: String, + pub description: String, pub out_dir: PathBuf, // TODO rem pub relative_times: bool, // TODO rem pub include_raw: bool, // TODO rem @@ -26,6 +39,7 @@ impl Config { match key { "email_fmt" => self.email_fmt = value.to_string(), "base_url" => self.base_url = value.to_string(), + "description" => self.description = value.to_string(), _ => {} } } diff --git a/src/time.rs b/src/time.rs @@ -1,4 +1,15 @@ -/// Useful "Good enough" time utils in Rust +// This file is licensed under the terms of 0BSD: +// +// Permission to use, copy, modify, and/or distribute this software for any purpose with or without +// fee is hereby granted. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +// SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +// OF THIS SOFTWARE. + use std::time::{SystemTime, UNIX_EPOCH}; const DAYS_IN_MONTHS: [i64; 12] = [31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29]; diff --git a/src/utils.rs b/src/utils.rs @@ -19,6 +19,7 @@ data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?> // partly stolen from // https://github.com/robinst/linkify/blob/demo/src/lib.rs#L5 +// Dual licensed under MIT and Apache pub fn email_body(body: &str) -> String { let mut bytes = Vec::new(); let mut in_reply: bool = false;