mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50:19 +00:00
bump pimalaya core v1
This commit is contained in:
parent
a0dea19cdf
commit
3b271c3e67
7 changed files with 501 additions and 781 deletions
1047
Cargo.lock
generated
1047
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
38
Cargo.toml
38
Cargo.toml
|
@ -21,12 +21,10 @@ default = [
|
|||
"maildir",
|
||||
#"notmuch",
|
||||
"smtp",
|
||||
"sendmail",
|
||||
|
||||
#"sendmail",
|
||||
#"keyring",
|
||||
#"oauth2",
|
||||
"wizard",
|
||||
|
||||
#"pgp-commands",
|
||||
#"pgp-gpg",
|
||||
#"pgp-native",
|
||||
|
@ -38,14 +36,14 @@ notmuch = ["email-lib/notmuch", "pimalaya-tui/notmuch"]
|
|||
smtp = ["email-lib/smtp", "pimalaya-tui/smtp"]
|
||||
sendmail = ["email-lib/sendmail", "pimalaya-tui/sendmail"]
|
||||
|
||||
keyring = ["email-lib/keyring", "pimalaya-tui/keyring", "secret-lib?/keyring-tokio"]
|
||||
keyring = ["email-lib/keyring", "pimalaya-tui/keyring", "secret-lib/keyring"]
|
||||
oauth2 = ["dep:oauth-lib", "email-lib/oauth2", "pimalaya-tui/oauth2", "keyring"]
|
||||
wizard = ["dep:email_address", "dep:secret-lib", "email-lib/autoconfig", "pimalaya-tui/wizard"]
|
||||
wizard = ["dep:email_address", "email-lib/autoconfig", "pimalaya-tui/wizard"]
|
||||
|
||||
pgp = []
|
||||
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
|
||||
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
||||
pgp-native = ["email-lib/pgp-native", "mml-lib/pgp-native", "pgp"]
|
||||
pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pimalaya-tui/pgp-commands", "pgp"]
|
||||
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pimalaya-tui/pgp-gpg", "pgp"]
|
||||
pgp-native = ["email-lib/pgp-native", "mml-lib/pgp-native", "pimalaya-tui/pgp-native", "pgp"]
|
||||
|
||||
[dependencies]
|
||||
ariadne = "0.2"
|
||||
|
@ -57,17 +55,17 @@ color-eyre = "0.6"
|
|||
comfy-table = "7.1"
|
||||
crossterm = { version = "0.27", features = ["serde"] }
|
||||
dirs = "4"
|
||||
email-lib = { version = "=0.25.0", default-features = false, features = ["derive", "thread", "tracing"] }
|
||||
email-lib = { version = "1", default-features = false, features = ["tokio-rustls", "derive", "thread"] }
|
||||
email_address = { version = "0.2", optional = true }
|
||||
mail-builder = "0.3"
|
||||
md5 = "0.7"
|
||||
mml-lib = { version = "=1.0.14", default-features = false, features = ["derive"] }
|
||||
oauth-lib = { version = "=0.1.1", optional = true }
|
||||
mml-lib = { version = "1", default-features = false, features = ["derive"] }
|
||||
oauth-lib = { version = "1", optional = true }
|
||||
once_cell = "1.16"
|
||||
petgraph = "0.6"
|
||||
pimalaya-tui = { version = "=0.1.0", default-features = false, features = ["email", "path", "cli", "himalaya", "tracing", "sled"] }
|
||||
process-lib = { version = "=0.4.2", features = ["derive"] }
|
||||
secret-lib = { version = "=0.4.6", default-features = false, features = ["command", "derive"], optional = true }
|
||||
pimalaya-tui = { version = "1", default-features = false, features = ["email", "path", "cli", "himalaya", "tracing", "sled"] }
|
||||
process-lib = { version = "1", features = ["derive"] }
|
||||
secret-lib = { version = "1", default-features = false, features = ["tokio", "rustls", "command", "derive"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
shellexpand-utils = "=0.2.1"
|
||||
|
@ -79,18 +77,16 @@ uuid = { version = "0.8", features = ["v4"] }
|
|||
|
||||
[patch.crates-io]
|
||||
# IMAP
|
||||
imap-codec = { git = "https://github.com/duesee/imap-codec" }
|
||||
imap-next = { git = "https://github.com/duesee/imap-next" }
|
||||
imap-client = { git = "https://github.com/pimalaya/imap-client" }
|
||||
|
||||
# Pimalaya core
|
||||
#email-lib = { git = "https://github.com/pimalaya/core" }
|
||||
email-lib = { path = "/home/soywod/code/pimalaya/core/email" }
|
||||
pgp-lib = { path = "/home/soywod/code/pimalaya/core/pgp" }
|
||||
keyring-lib = { git = "https://github.com/pimalaya/core" }
|
||||
email-lib = { git = "https://github.com/pimalaya/core" }
|
||||
mml-lib = { git = "https://github.com/pimalaya/core" }
|
||||
oauth-lib = { git = "https://github.com/pimalaya/core" }
|
||||
process-lib = { git = "https://github.com/pimalaya/core" }
|
||||
secret-lib = { git = "https://github.com/pimalaya/core" }
|
||||
|
||||
# Pimalaya TUI
|
||||
#pimalaya-tui = { git = "https://github.com/pimalaya/tui" }
|
||||
pimalaya-tui = { path = "/home/soywod/code/pimalaya/tui" }
|
||||
# Pimalaya non-core
|
||||
pimalaya-tui = { git = "https://github.com/pimalaya/tui" }
|
||||
|
|
|
@ -13,7 +13,10 @@ use email::notmuch::NotmuchContextBuilder;
|
|||
use email::sendmail::SendmailContextBuilder;
|
||||
#[cfg(feature = "smtp")]
|
||||
use email::smtp::SmtpContextBuilder;
|
||||
use pimalaya_tui::terminal::{cli::printer::Printer, config::TomlConfig as _};
|
||||
use pimalaya_tui::{
|
||||
himalaya::config::{Backend, SendingBackend},
|
||||
terminal::{cli::printer::Printer, config::TomlConfig as _},
|
||||
};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{account::arg::name::OptionalAccountNameArg, config::TomlConfig};
|
||||
|
@ -42,56 +45,65 @@ impl AccountCheckUpCommand {
|
|||
|
||||
printer.log("Checking backend context integrity…")?;
|
||||
|
||||
#[cfg(feature = "maildir")]
|
||||
if let Some(mdir_config) = toml_account_config.maildir {
|
||||
printer.log("Checking Maildir integrity…")?;
|
||||
match toml_account_config.backend {
|
||||
#[cfg(feature = "maildir")]
|
||||
Some(Backend::Maildir(mdir_config)) => {
|
||||
printer.log("Checking Maildir integrity…")?;
|
||||
|
||||
let ctx = MaildirContextBuilder::new(account_config.clone(), Arc::new(mdir_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
let ctx = MaildirContextBuilder::new(account_config.clone(), Arc::new(mdir_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
#[cfg(feature = "imap")]
|
||||
Some(Backend::Imap(imap_config)) => {
|
||||
printer.log("Checking IMAP integrity…")?;
|
||||
|
||||
let ctx = ImapContextBuilder::new(account_config.clone(), Arc::new(imap_config))
|
||||
.with_pool_size(1);
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
#[cfg(feature = "notmuch")]
|
||||
Some(Backend::Notmuch(notmuch_config)) => {
|
||||
printer.log("Checking Notmuch integrity…")?;
|
||||
|
||||
let ctx =
|
||||
NotmuchContextBuilder::new(account_config.clone(), Arc::new(notmuch_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
#[cfg(feature = "imap")]
|
||||
if let Some(imap_config) = toml_account_config.imap {
|
||||
printer.log("Checking IMAP integrity…")?;
|
||||
let sending_backend = toml_account_config
|
||||
.message
|
||||
.and_then(|msg| msg.send)
|
||||
.and_then(|send| send.backend);
|
||||
|
||||
let ctx = ImapContextBuilder::new(account_config.clone(), Arc::new(imap_config))
|
||||
.with_pool_size(1);
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
match sending_backend {
|
||||
#[cfg(feature = "smtp")]
|
||||
Some(SendingBackend::Smtp(smtp_config)) => {
|
||||
printer.log("Checking Smtp integrity…")?;
|
||||
|
||||
#[cfg(feature = "notmuch")]
|
||||
if let Some(notmuch_config) = toml_account_config.notmuch {
|
||||
printer.log("Checking Notmuch integrity…")?;
|
||||
let ctx = SmtpContextBuilder::new(account_config.clone(), Arc::new(smtp_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
#[cfg(feature = "sendmail")]
|
||||
Some(SendingBackend::Sendmail(sendmail_config)) => {
|
||||
printer.log("Checking Sendmail integrity…")?;
|
||||
|
||||
let ctx = NotmuchContextBuilder::new(account_config.clone(), Arc::new(notmuch_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "smtp")]
|
||||
if let Some(smtp_config) = toml_account_config.smtp {
|
||||
printer.log("Checking SMTP integrity…")?;
|
||||
|
||||
let ctx = SmtpContextBuilder::new(account_config.clone(), Arc::new(smtp_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "sendmail")]
|
||||
if let Some(sendmail_config) = toml_account_config.sendmail {
|
||||
printer.log("Checking Sendmail integrity…")?;
|
||||
|
||||
let ctx =
|
||||
SendmailContextBuilder::new(account_config.clone(), Arc::new(sendmail_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
let ctx =
|
||||
SendmailContextBuilder::new(account_config.clone(), Arc::new(sendmail_config));
|
||||
BackendBuilder::new(account_config.clone(), ctx)
|
||||
.check_up()
|
||||
.await?;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
printer.out("Checkup successfully completed!")
|
||||
|
|
|
@ -40,13 +40,14 @@ impl AccountConfigureCommand {
|
|||
|
||||
if self.reset {
|
||||
#[cfg(feature = "imap")]
|
||||
if let Some(config) = &toml_account_config.imap {
|
||||
let reset = match &config.auth {
|
||||
ImapAuthConfig::Passwd(config) => config.reset().await,
|
||||
{
|
||||
let reset = match toml_account_config.imap_auth_config() {
|
||||
Some(ImapAuthConfig::Password(config)) => config.reset().await,
|
||||
#[cfg(feature = "oauth2")]
|
||||
ImapAuthConfig::OAuth2(config) => config.reset().await,
|
||||
ImapAuthConfig::MissingOAuth2Feature => unreachable!(),
|
||||
Some(ImapAuthConfig::OAuth2(config)) => config.reset().await,
|
||||
_ => Ok(()),
|
||||
};
|
||||
|
||||
if let Err(err) = reset {
|
||||
warn!("error while resetting imap secrets: {err}");
|
||||
debug!("error while resetting imap secrets: {err:?}");
|
||||
|
@ -54,12 +55,14 @@ impl AccountConfigureCommand {
|
|||
}
|
||||
|
||||
#[cfg(feature = "smtp")]
|
||||
if let Some(config) = &toml_account_config.smtp {
|
||||
let reset = match &config.auth {
|
||||
SmtpAuthConfig::Passwd(config) => config.reset().await,
|
||||
{
|
||||
let reset = match toml_account_config.smtp_auth_config() {
|
||||
Some(SmtpAuthConfig::Passwd(config)) => config.reset().await,
|
||||
#[cfg(feature = "oauth2")]
|
||||
SmtpAuthConfig::OAuth2(config) => config.reset().await,
|
||||
Some(SmtpAuthConfig::OAuth2(config)) => config.reset().await,
|
||||
_ => Ok(()),
|
||||
};
|
||||
|
||||
if let Err(err) = reset {
|
||||
warn!("error while resetting smtp secrets: {err}");
|
||||
debug!("error while resetting smtp secrets: {err:?}");
|
||||
|
@ -67,50 +70,47 @@ impl AccountConfigureCommand {
|
|||
}
|
||||
|
||||
#[cfg(feature = "pgp")]
|
||||
if let Some(ref config) = account_config.pgp {
|
||||
if let Some(config) = &toml_account_config.pgp {
|
||||
config.reset().await?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "imap")]
|
||||
if let Some(config) = &toml_account_config.imap {
|
||||
match &config.auth {
|
||||
ImapAuthConfig::Passwd(config) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::password("IMAP password")?))
|
||||
.await
|
||||
}
|
||||
#[cfg(feature = "oauth2")]
|
||||
ImapAuthConfig::OAuth2(config) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::secret("IMAP OAuth 2.0 clientsecret")?))
|
||||
.await
|
||||
}
|
||||
ImapAuthConfig::MissingOAuth2Feature => unreachable!(),
|
||||
}?;
|
||||
}
|
||||
match toml_account_config.imap_auth_config() {
|
||||
Some(ImapAuthConfig::Password(config)) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::password("IMAP password")?))
|
||||
.await
|
||||
}
|
||||
#[cfg(feature = "oauth2")]
|
||||
Some(ImapAuthConfig::OAuth2(config)) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::secret("IMAP OAuth 2.0 client secret")?))
|
||||
.await
|
||||
}
|
||||
_ => Ok(()),
|
||||
}?;
|
||||
|
||||
#[cfg(feature = "smtp")]
|
||||
if let Some(config) = &toml_account_config.smtp {
|
||||
match &config.auth {
|
||||
SmtpAuthConfig::Passwd(config) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::password("SMTP password")?))
|
||||
.await
|
||||
}
|
||||
#[cfg(feature = "oauth2")]
|
||||
SmtpAuthConfig::OAuth2(config) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::secret("SMTP OAuth 2.0 client secret")?))
|
||||
.await
|
||||
}
|
||||
}?;
|
||||
}
|
||||
match toml_account_config.smtp_auth_config() {
|
||||
Some(SmtpAuthConfig::Passwd(config)) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::password("SMTP password")?))
|
||||
.await
|
||||
}
|
||||
#[cfg(feature = "oauth2")]
|
||||
Some(SmtpAuthConfig::OAuth2(config)) => {
|
||||
config
|
||||
.configure(|| Ok(prompt::secret("SMTP OAuth 2.0 client secret")?))
|
||||
.await
|
||||
}
|
||||
_ => Ok(()),
|
||||
}?;
|
||||
|
||||
#[cfg(feature = "pgp")]
|
||||
if let Some(ref config) = account_config.pgp {
|
||||
if let Some(config) = &toml_account_config.pgp {
|
||||
config
|
||||
.configure(&account_config.email, || {
|
||||
.configure(&toml_account_config.email, || {
|
||||
Ok(prompt::password("PGP secret key password")?)
|
||||
})
|
||||
.await?;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#[cfg(feature = "wizard")]
|
||||
use pimalaya_tui::himalaya::config::HimalayaTomlConfig;
|
||||
|
||||
pub type TomlConfig = HimalayaTomlConfig;
|
||||
|
|
|
@ -45,9 +45,11 @@ impl TemplateSaveCommand {
|
|||
.clone()
|
||||
.into_account_configs(self.account.name.as_deref())?;
|
||||
|
||||
let account_config = Arc::new(account_config);
|
||||
|
||||
let backend = BackendBuilder::new(
|
||||
Arc::new(toml_account_config),
|
||||
Arc::new(account_config),
|
||||
account_config.clone(),
|
||||
|builder| {
|
||||
builder
|
||||
.without_features()
|
||||
|
|
|
@ -39,9 +39,11 @@ impl TemplateSendCommand {
|
|||
.clone()
|
||||
.into_account_configs(self.account.name.as_deref())?;
|
||||
|
||||
let account_config = Arc::new(account_config);
|
||||
|
||||
let backend = BackendBuilder::new(
|
||||
Arc::new(toml_account_config),
|
||||
Arc::new(account_config),
|
||||
account_config.clone(),
|
||||
|builder| {
|
||||
builder
|
||||
.without_features()
|
||||
|
|
Loading…
Reference in a new issue