Compare commits
3 Commits
06e65a52b3
...
89cb1e4e75
| Author | SHA1 | Date | |
|---|---|---|---|
| 89cb1e4e75 | |||
| 46021c5d2c | |||
| 4243f7b77d |
52
Cargo.lock
generated
52
Cargo.lock
generated
@ -3155,6 +3155,20 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-notmuch"
|
name = "letterbox-notmuch"
|
||||||
version = "0.17.38"
|
version = "0.17.38"
|
||||||
|
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
|
||||||
|
checksum = "30c0d92d929ce67e832d2dea079289b211dc79b4b138857518da2ce3cf50f53a"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"mailparse",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror 2.0.16",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "letterbox-notmuch"
|
||||||
|
version = "0.17.40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"log",
|
"log",
|
||||||
@ -3167,28 +3181,14 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "letterbox-notmuch"
|
|
||||||
version = "0.17.38"
|
|
||||||
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
|
|
||||||
checksum = "30c0d92d929ce67e832d2dea079289b211dc79b4b138857518da2ce3cf50f53a"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"mailparse",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"thiserror 2.0.16",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-procmail2notmuch"
|
name = "letterbox-procmail2notmuch"
|
||||||
version = "0.17.38"
|
version = "0.17.40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
"letterbox-notmuch 0.17.38 (sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/)",
|
"letterbox-notmuch 0.17.38",
|
||||||
"letterbox-shared 0.17.38 (sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/)",
|
"letterbox-shared 0.17.38",
|
||||||
"serde",
|
"serde",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tokio 1.47.1",
|
"tokio 1.47.1",
|
||||||
@ -3196,7 +3196,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-server"
|
name = "letterbox-server"
|
||||||
version = "0.17.38"
|
version = "0.17.40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ammonia",
|
"ammonia",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -3219,8 +3219,8 @@ dependencies = [
|
|||||||
"html-escape",
|
"html-escape",
|
||||||
"html2text",
|
"html2text",
|
||||||
"ical",
|
"ical",
|
||||||
"letterbox-notmuch 0.17.38",
|
"letterbox-notmuch 0.17.40",
|
||||||
"letterbox-shared 0.17.38",
|
"letterbox-shared 0.17.40",
|
||||||
"linkify",
|
"linkify",
|
||||||
"lol_html",
|
"lol_html",
|
||||||
"mailparse",
|
"mailparse",
|
||||||
@ -3247,6 +3247,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-shared"
|
name = "letterbox-shared"
|
||||||
version = "0.17.38"
|
version = "0.17.38"
|
||||||
|
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
|
||||||
|
checksum = "1bf39370ba5e17772b3920b7928e710462eac16b58afa00771c1e25c11fdb9ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-info",
|
"build-info",
|
||||||
"letterbox-notmuch 0.17.38",
|
"letterbox-notmuch 0.17.38",
|
||||||
@ -3259,12 +3261,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-shared"
|
name = "letterbox-shared"
|
||||||
version = "0.17.38"
|
version = "0.17.40"
|
||||||
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
|
|
||||||
checksum = "1bf39370ba5e17772b3920b7928e710462eac16b58afa00771c1e25c11fdb9ac"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-info",
|
"build-info",
|
||||||
"letterbox-notmuch 0.17.38 (sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/)",
|
"letterbox-notmuch 0.17.40",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
@ -3274,7 +3274,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "letterbox-web"
|
name = "letterbox-web"
|
||||||
version = "0.17.38"
|
version = "0.17.40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build-info",
|
"build-info",
|
||||||
"build-info-build",
|
"build-info-build",
|
||||||
@ -3286,7 +3286,7 @@ dependencies = [
|
|||||||
"graphql_client",
|
"graphql_client",
|
||||||
"human_format",
|
"human_format",
|
||||||
"itertools",
|
"itertools",
|
||||||
"letterbox-shared 0.17.38",
|
"letterbox-shared 0.17.40",
|
||||||
"log",
|
"log",
|
||||||
"seed",
|
"seed",
|
||||||
"seed_hooks",
|
"seed_hooks",
|
||||||
|
|||||||
@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "UNLICENSED"
|
license = "UNLICENSED"
|
||||||
publish = ["xinu"]
|
publish = ["xinu"]
|
||||||
version = "0.17.38"
|
version = "0.17.40"
|
||||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|||||||
@ -32,8 +32,8 @@ futures = "0.3.31"
|
|||||||
headers = "0.4.0"
|
headers = "0.4.0"
|
||||||
html-escape = "0.2.13"
|
html-escape = "0.2.13"
|
||||||
ical = "0.11"
|
ical = "0.11"
|
||||||
letterbox-notmuch = { path = "../notmuch", version = "0.17.38", registry = "xinu" }
|
letterbox-notmuch = { path = "../notmuch", version = "0.17.40", registry = "xinu" }
|
||||||
letterbox-shared = { path = "../shared", version = "0.17.38", registry = "xinu" }
|
letterbox-shared = { path = "../shared", version = "0.17.40", registry = "xinu" }
|
||||||
linkify = "0.10.0"
|
linkify = "0.10.0"
|
||||||
lol_html = "2.3.0"
|
lol_html = "2.3.0"
|
||||||
mailparse = "0.16.1"
|
mailparse = "0.16.1"
|
||||||
|
|||||||
@ -1,3 +1,60 @@
|
|||||||
|
use std::io::{Cursor, Read};
|
||||||
|
|
||||||
|
use askama::Template;
|
||||||
|
use chrono::{Datelike, Local, LocalResult, TimeZone, Utc};
|
||||||
|
use chrono_tz::Tz;
|
||||||
|
use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail};
|
||||||
|
use quick_xml::de::from_str as xml_from_str;
|
||||||
|
use tracing::{error, info, warn};
|
||||||
|
use zip::ZipArchive;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
error::ServerError,
|
||||||
|
graphql::{Attachment, Body, DispositionType, Email, Html, PlainText, UnhandledContentType},
|
||||||
|
linkify_html,
|
||||||
|
};
|
||||||
|
|
||||||
|
const APPLICATION_GZIP: &'static str = "application/gzip";
|
||||||
|
|
||||||
|
const APPLICATION_ZIP: &'static str = "application/zip";
|
||||||
|
const IMAGE_JPEG: &'static str = "image/jpeg";
|
||||||
|
const IMAGE_PJPEG: &'static str = "image/pjpeg";
|
||||||
|
const IMAGE_PNG: &'static str = "image/png";
|
||||||
|
const MESSAGE_RFC822: &'static str = "message/rfc822";
|
||||||
|
const MULTIPART_ALTERNATIVE: &'static str = "multipart/alternative";
|
||||||
|
const MULTIPART_MIXED: &'static str = "multipart/mixed";
|
||||||
|
const MULTIPART_RELATED: &'static str = "multipart/related";
|
||||||
|
const MULTIPART_REPORT: &'static str = "multipart/report";
|
||||||
|
const TEXT_CALENDAR: &'static str = "text/calendar";
|
||||||
|
const TEXT_HTML: &'static str = "text/html";
|
||||||
|
const TEXT_PLAIN: &'static str = "text/plain";
|
||||||
|
|
||||||
|
// Inline Askama filters module for template use
|
||||||
|
mod filters {
|
||||||
|
// Usage: {{ items|batch(7) }}
|
||||||
|
pub fn batch<T: Clone>(
|
||||||
|
items: &[T],
|
||||||
|
_: &dyn ::askama::Values,
|
||||||
|
size: usize,
|
||||||
|
) -> askama::Result<Vec<Vec<T>>> {
|
||||||
|
if size == 0 {
|
||||||
|
return Ok(vec![]);
|
||||||
|
}
|
||||||
|
let mut out = Vec::new();
|
||||||
|
let mut chunk = Vec::with_capacity(size);
|
||||||
|
for item in items {
|
||||||
|
chunk.push(item.clone());
|
||||||
|
if chunk.len() == size {
|
||||||
|
out.push(chunk);
|
||||||
|
chunk = Vec::with_capacity(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !chunk.is_empty() {
|
||||||
|
out.push(chunk);
|
||||||
|
}
|
||||||
|
Ok(out)
|
||||||
|
}
|
||||||
|
}
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct ExtractedCalendarMetadata {
|
pub struct ExtractedCalendarMetadata {
|
||||||
pub is_google_calendar_event: bool,
|
pub is_google_calendar_event: bool,
|
||||||
@ -443,72 +500,6 @@ pub fn extract_calendar_metadata_from_mail(
|
|||||||
body_html,
|
body_html,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
pub struct ExtractedCalendarMetadata {
|
|
||||||
pub is_google_calendar_event: bool,
|
|
||||||
pub summary: Option<String>,
|
|
||||||
pub organizer: Option<String>,
|
|
||||||
pub start_date: Option<String>,
|
|
||||||
pub end_date: Option<String>,
|
|
||||||
pub body_html: Option<String>,
|
|
||||||
}
|
|
||||||
// Inline Askama filters module for template use
|
|
||||||
mod filters {
|
|
||||||
// Usage: {{ items|batch(7) }}
|
|
||||||
pub fn batch<T: Clone>(
|
|
||||||
items: &[T],
|
|
||||||
_: &dyn ::askama::Values,
|
|
||||||
size: usize,
|
|
||||||
) -> askama::Result<Vec<Vec<T>>> {
|
|
||||||
if size == 0 {
|
|
||||||
return Ok(vec![]);
|
|
||||||
}
|
|
||||||
let mut out = Vec::new();
|
|
||||||
let mut chunk = Vec::with_capacity(size);
|
|
||||||
for item in items {
|
|
||||||
chunk.push(item.clone());
|
|
||||||
if chunk.len() == size {
|
|
||||||
out.push(chunk);
|
|
||||||
chunk = Vec::with_capacity(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !chunk.is_empty() {
|
|
||||||
out.push(chunk);
|
|
||||||
}
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
use std::io::{Cursor, Read};
|
|
||||||
|
|
||||||
use askama::Template;
|
|
||||||
use chrono::{Datelike, Local, LocalResult, TimeZone, Utc};
|
|
||||||
use chrono_tz::Tz;
|
|
||||||
use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail};
|
|
||||||
use quick_xml::de::from_str as xml_from_str;
|
|
||||||
use tracing::{error, info, warn};
|
|
||||||
use zip::ZipArchive;
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
error::ServerError,
|
|
||||||
graphql::{Attachment, Body, DispositionType, Email, Html, PlainText, UnhandledContentType},
|
|
||||||
linkify_html,
|
|
||||||
};
|
|
||||||
|
|
||||||
const APPLICATION_GZIP: &'static str = "application/gzip";
|
|
||||||
|
|
||||||
const APPLICATION_ZIP: &'static str = "application/zip";
|
|
||||||
const IMAGE_JPEG: &'static str = "image/jpeg";
|
|
||||||
const IMAGE_PJPEG: &'static str = "image/pjpeg";
|
|
||||||
const IMAGE_PNG: &'static str = "image/png";
|
|
||||||
const MESSAGE_RFC822: &'static str = "message/rfc822";
|
|
||||||
const MULTIPART_ALTERNATIVE: &'static str = "multipart/alternative";
|
|
||||||
const MULTIPART_MIXED: &'static str = "multipart/mixed";
|
|
||||||
const MULTIPART_RELATED: &'static str = "multipart/related";
|
|
||||||
const MULTIPART_REPORT: &'static str = "multipart/report";
|
|
||||||
const TEXT_CALENDAR: &'static str = "text/calendar";
|
|
||||||
const TEXT_HTML: &'static str = "text/html";
|
|
||||||
const TEXT_PLAIN: &'static str = "text/plain";
|
|
||||||
|
|
||||||
pub fn email_addresses(
|
pub fn email_addresses(
|
||||||
_path: &str,
|
_path: &str,
|
||||||
m: &ParsedMail,
|
m: &ParsedMail,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ version.workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
build-info = "0.0.41"
|
build-info = "0.0.41"
|
||||||
letterbox-notmuch = { path = "../notmuch", version = "0.17.38", registry = "xinu" }
|
letterbox-notmuch = { path = "../notmuch", version = "0.17.40", registry = "xinu" }
|
||||||
regex = "1.11.1"
|
regex = "1.11.1"
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
sqlx = "0.8.5"
|
sqlx = "0.8.5"
|
||||||
|
|||||||
@ -33,7 +33,7 @@ wasm-bindgen = "=0.2.100"
|
|||||||
uuid = { version = "1.16.0", features = [
|
uuid = { version = "1.16.0", features = [
|
||||||
"js",
|
"js",
|
||||||
] } # direct dep to set js feature, prevents Rng issues
|
] } # direct dep to set js feature, prevents Rng issues
|
||||||
letterbox-shared = { path = "../shared/", version = "0.17.38", registry = "xinu" }
|
letterbox-shared = { path = "../shared/", version = "0.17.40", registry = "xinu" }
|
||||||
seed_hooks = { version = "0.4.1", registry = "xinu" }
|
seed_hooks = { version = "0.4.1", registry = "xinu" }
|
||||||
strum_macros = "0.27.1"
|
strum_macros = "0.27.1"
|
||||||
gloo-console = "0.3.0"
|
gloo-console = "0.3.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user