Compare commits
5 Commits
487d7084c3
...
1210f7038a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1210f7038a | |||
| f9ab7284a3 | |||
| 100865c923 | |||
| b8c1710a83 | |||
| 215b8cd41d |
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2034,7 +2034,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "letterbox"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"build-info-build",
|
||||
@ -2393,7 +2393,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notmuch"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"log",
|
||||
@ -2983,7 +2983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "procmail2notmuch"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
@ -3750,7 +3750,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "server"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"anyhow",
|
||||
@ -3835,7 +3835,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "shared"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"notmuch",
|
||||
|
||||
4
dev.sh
4
dev.sh
@ -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 ../shared -w ../notmuch -w ./" C-m
|
||||
tmux send-keys "cd web; trunk serve -w ../.git -w ../shared -w ../notmuch -w ./" C-m
|
||||
tmux new-window -n server
|
||||
tmux send-keys "cd server; cargo watch -c -x run -w ../shared -w ../notmuch -w ./" C-m
|
||||
tmux send-keys "cd server; cargo watch -c -x run -w ../.git -w ../shared -w ../notmuch -w ./" C-m
|
||||
tmux attach -d -t letterbox-dev
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "notmuch"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "procmail2notmuch"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "server"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
edition = "2021"
|
||||
default-run = "server"
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ use crate::{
|
||||
Attachment, Body, DispositionType, Email, EmailThread, Header, Html, Message, PlainText,
|
||||
Tag, Thread, ThreadSummary, UnhandledContentType,
|
||||
},
|
||||
linkify_html, sanitize_html,
|
||||
linkify_html, InlineStyle, SanitizeHtml, Transformer,
|
||||
};
|
||||
|
||||
const TEXT_PLAIN: &'static str = "text/plain";
|
||||
@ -169,17 +169,29 @@ pub async fn thread(
|
||||
};
|
||||
|
||||
Body::Html(Html {
|
||||
html: format!(
|
||||
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!(
|
||||
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.
|
||||
sanitize_html(
|
||||
&linkify_html(&text.trim_matches('\n')),
|
||||
&cid_prefix,
|
||||
&base_url
|
||||
)?
|
||||
),
|
||||
html
|
||||
)
|
||||
},
|
||||
content_tree: if debug_content_tree {
|
||||
render_content_type_tree(&m)
|
||||
} else {
|
||||
@ -187,8 +199,27 @@ pub async fn thread(
|
||||
},
|
||||
})
|
||||
}
|
||||
Body::Html(Html { html, content_tree }) => Body::Html(Html {
|
||||
html: sanitize_html(&html, &cid_prefix, &base_url)?,
|
||||
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
|
||||
},
|
||||
|
||||
content_tree: if debug_content_tree {
|
||||
render_content_type_tree(&m)
|
||||
} else {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "shared"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -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)]
|
||||
@ -34,16 +34,12 @@ pub mod urls {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn build_version(bi:fn()->&'static BuildInfo) -> String {
|
||||
pub fn build_version(bi: fn() -> &'static BuildInfo) -> String {
|
||||
fn commit(git: &Option<VersionControl>) -> String {
|
||||
let Some(VersionControl::Git(git)) = git else {
|
||||
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})"));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
name = "letterbox"
|
||||
repository = "https://github.com/seed-rs/seed-quickstart"
|
||||
authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
.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)/
|
||||
Loading…
x
Reference in New Issue
Block a user