mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit f9d2521512c06410ba68c8855747c9549a37f3e3
parent e6aa8befceeec813d1432f3c64e81e8c0923ea61
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Tue, 20 Jul 2021 20:48:11 -0700

Remove umused mail module

Diffstat:
MCargo.lock | 58+++-------------------------------------------------------
MCargo.toml | 1-
Dsrc/mail.rs | 49-------------------------------------------------
Msrc/main.rs | 4----
4 files changed, 3 insertions(+), 109 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -340,15 +340,6 @@ checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" [[package]] name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - -[[package]] -name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" @@ -420,12 +411,6 @@ dependencies = [ ] [[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] name = "cache-padded" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -453,16 +438,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "charset" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f426e64df1c3de26cbf44593c6ffff5dbfd43bbf9de0d075058558126b3fc73" -dependencies = [ - "base64 0.10.1", - "encoding_rs", -] - -[[package]] name = "chrono" version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -506,7 +481,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" dependencies = [ "aes-gcm", - "base64 0.13.0", + "base64", "hkdf", "hmac", "percent-encoding", @@ -621,15 +596,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" [[package]] -name = "encoding_rs" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] name = "event-listener" version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -900,7 +866,7 @@ dependencies = [ "anyhow", "async-channel", "async-std", - "base64 0.13.0", + "base64", "cookie", "futures-lite", "infer", @@ -1069,17 +1035,6 @@ dependencies = [ ] [[package]] -name = "mailparse" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06f526fc13a50f46a3689a6f438cb833c59817c898bb40a3954f341ddf74ce1" -dependencies = [ - "base64 0.13.0", - "charset", - "quoted_printable", -] - -[[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1111,7 +1066,6 @@ dependencies = [ "async-trait", "chrono", "git2", - "mailparse", "once_cell", "percent-encoding", "pico-args", @@ -1266,7 +1220,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "679104537029ed2287c216bfb942bbf723f48ee98f0aef15611634173a74ef21" dependencies = [ - "base64 0.13.0", + "base64", "chrono", "indexmap", "line-wrap", @@ -1347,12 +1301,6 @@ dependencies = [ ] [[package]] -name = "quoted_printable" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1238256b09923649ec89b08104c4dfe9f6cb2fea734a5db5384e44916d59e9c5" - -[[package]] name = "radium" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml @@ -15,7 +15,6 @@ async-std = { version = "1.8.0", features = ["attributes"] } async-trait = "0.1.48" chrono = "0.4" git2 = { version="0.13", default-features = false } -mailparse = "0.13" once_cell = "1.7.2" percent-encoding = "2.1" pico-args = "0.4" diff --git a/src/mail.rs b/src/mail.rs @@ -1,49 +0,0 @@ -use askama::Template; -use tide::Request; - -use std::fs; - -use mailparse::{parse_mail, MailHeaderMap, ParsedMail}; -/* Mail related routes */ - -// TODO create a thread object, a collection of references to emails - -#[derive(Template)] -#[template(path = "list-threads.html")] // using the template in this path, relative -struct ListThreadsTemplate { - emails: Vec<Email>, -} - -struct Email { - subject: String, -} - -impl Email { - fn from_parsed(mail: &ParsedMail) -> tide::Result<Self> { - Ok(Email { - subject: mail.headers.get_first_value("Subject").unwrap(), - }) - } -} -/* This function handles a lot */ -pub async fn list_threads(req: Request<()>) -> tide::Result { - let mail_files = fs::read_dir("./mail")?; - let mut result = vec![]; - for mail_file in mail_files { - let path = mail_file?.path(); - let bytes = fs::read(path)?; - let parsed = parse_mail(&bytes)?; - // we need to create a struct with relevant owned data - let mail = Email::from_parsed(&parsed)?; - result.push(mail); - } - Ok(ListThreadsTemplate { emails: result }.into()) -} - -async fn show_thread(req: Request<()>) -> tide::Result { - Ok("".into()) -} - -async fn raw_email(req: Request<()>) -> tide::Result { - Ok("".into()) -} diff --git a/src/main.rs b/src/main.rs @@ -16,7 +16,6 @@ use tide::{http, Request, Response}; mod errorpage; mod filters; -mod mail; #[derive(Deserialize, Debug)] pub struct Config { @@ -1049,9 +1048,6 @@ async fn main() -> Result<(), std::io::Error> { app.at("/robots.txt").get(static_resource); app.at("/Feed-icon.svg").get(static_resource); - // Raw files, patch files - app.at("/mail").get(mail::list_threads); - app.at("/:repo_name").get(repo_home); app.at("/:repo_name/").get(repo_home);