Compare commits

..

No commits in common. "1210f7038a019f339cc212cee6f1a10d73bfd94d" and "487d7084c315cbb6dc5938279317874f3c14cb13" have entirely different histories.

10 changed files with 40 additions and 59 deletions

10
Cargo.lock generated
View File

@ -2034,7 +2034,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "letterbox"
version = "0.0.7"
version = "0.0.6"
dependencies = [
"build-info",
"build-info-build",
@ -2393,7 +2393,7 @@ dependencies = [
[[package]]
name = "notmuch"
version = "0.0.7"
version = "0.0.6"
dependencies = [
"itertools",
"log",
@ -2983,7 +2983,7 @@ dependencies = [
[[package]]
name = "procmail2notmuch"
version = "0.0.7"
version = "0.0.6"
dependencies = [
"anyhow",
]
@ -3750,7 +3750,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.0.7"
version = "0.0.6"
dependencies = [
"ammonia",
"anyhow",
@ -3835,7 +3835,7 @@ dependencies = [
[[package]]
name = "shared"
version = "0.0.7"
version = "0.0.6"
dependencies = [
"build-info",
"notmuch",

4
dev.sh
View File

@ -1,7 +1,7 @@
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
tmux new-session -d -s letterbox-dev
tmux rename-window web
tmux send-keys "cd web; trunk serve -w ../.git -w ../shared -w ../notmuch -w ./" C-m
tmux send-keys "cd web; trunk serve -w ../shared -w ../notmuch -w ./" C-m
tmux new-window -n server
tmux send-keys "cd server; cargo watch -c -x run -w ../.git -w ../shared -w ../notmuch -w ./" C-m
tmux send-keys "cd server; cargo watch -c -x run -w ../shared -w ../notmuch -w ./" C-m
tmux attach -d -t letterbox-dev

View File

@ -1,6 +1,6 @@
[package]
name = "notmuch"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "procmail2notmuch"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
default-run = "server"

View File

@ -17,7 +17,7 @@ use crate::{
Attachment, Body, DispositionType, Email, EmailThread, Header, Html, Message, PlainText,
Tag, Thread, ThreadSummary, UnhandledContentType,
},
linkify_html, InlineStyle, SanitizeHtml, Transformer,
linkify_html, sanitize_html,
};
const TEXT_PLAIN: &'static str = "text/plain";
@ -169,29 +169,17 @@ pub async fn thread(
};
Body::Html(Html {
html: {
let body_tranformers: Vec<Box<dyn Transformer>> = vec![
Box::new(InlineStyle),
Box::new(SanitizeHtml {
cid_prefix: &cid_prefix,
base_url: &base_url,
}),
];
let mut html = linkify_html(&text.trim_matches('\n'));
for t in body_tranformers.iter() {
if t.should_run(&None, &html) {
html = t.transform(&None, &html).await?;
}
}
format!(
html: format!(
r#"<p class="view-part-text-plain">{}</p>"#,
// Trim newlines to prevent excessive white space at the beginning/end of
// presenation. Leave tabs and spaces incase plain text attempts to center a
// header on the first line.
html
)
},
sanitize_html(
&linkify_html(&text.trim_matches('\n')),
&cid_prefix,
&base_url
)?
),
content_tree: if debug_content_tree {
render_content_type_tree(&m)
} else {
@ -199,27 +187,8 @@ pub async fn thread(
},
})
}
Body::Html(Html {
mut html,
content_tree,
}) => Body::Html(Html {
html: {
let body_tranformers: Vec<Box<dyn Transformer>> = vec![
// TODO: this breaks things like emails from calendar
//Box::new(InlineStyle),
Box::new(SanitizeHtml {
cid_prefix: &cid_prefix,
base_url: &base_url,
}),
];
for t in body_tranformers.iter() {
if t.should_run(&None, &html) {
html = t.transform(&None, &html).await?;
}
}
html
},
Body::Html(Html { html, content_tree }) => Body::Html(Html {
html: sanitize_html(&html, &cid_prefix, &base_url)?,
content_tree: if debug_content_tree {
render_content_type_tree(&m)
} else {

View File

@ -1,6 +1,6 @@
[package]
name = "shared"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
use build_info::{BuildInfo, VersionControl};
use notmuch::SearchSummary;
use build_info::{VersionControl,BuildInfo};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
@ -40,6 +40,10 @@ pub fn build_version(bi: fn() -> &'static BuildInfo) -> String {
return String::new();
};
let mut s = vec!["-".to_string(), git.commit_short_id.clone()];
if git.dirty {
s.push(".+".to_string());
}
if let Some(branch) = &git.branch {
s.push(format!(" ({branch})"));
}

View File

@ -1,5 +1,5 @@
[package]
version = "0.0.7"
version = "0.0.6"
name = "letterbox"
repository = "https://github.com/seed-rs/seed-quickstart"
authors = ["Bill Thiede <git@xinu.tv>"]

8
web/Makefile Normal file
View File

@ -0,0 +1,8 @@
.PHONY: all
APP=letterbox
# Build in release mode and push to minio for serving.
all:
trunk build --release
mc mirror m/$(APP)/ /tmp/$(APP)-$(shell date +%s)
mc mirror --overwrite --remove dist/ m/$(APP)/