bump pimalaya core v1

This commit is contained in:
Clément DOUIN 2024-10-24 15:21:13 +02:00
parent a0dea19cdf
commit 3b271c3e67
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
7 changed files with 501 additions and 781 deletions

1047
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -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" }

View file

@ -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,8 +45,9 @@ impl AccountCheckUpCommand {
printer.log("Checking backend context integrity…")?;
match toml_account_config.backend {
#[cfg(feature = "maildir")]
if let Some(mdir_config) = toml_account_config.maildir {
Some(Backend::Maildir(mdir_config)) => {
printer.log("Checking Maildir integrity…")?;
let ctx = MaildirContextBuilder::new(account_config.clone(), Arc::new(mdir_config));
@ -51,9 +55,8 @@ impl AccountCheckUpCommand {
.check_up()
.await?;
}
#[cfg(feature = "imap")]
if let Some(imap_config) = toml_account_config.imap {
Some(Backend::Imap(imap_config)) => {
printer.log("Checking IMAP integrity…")?;
let ctx = ImapContextBuilder::new(account_config.clone(), Arc::new(imap_config))
@ -62,29 +65,36 @@ impl AccountCheckUpCommand {
.check_up()
.await?;
}
#[cfg(feature = "notmuch")]
if let Some(notmuch_config) = toml_account_config.notmuch {
Some(Backend::Notmuch(notmuch_config)) => {
printer.log("Checking Notmuch integrity…")?;
let ctx = NotmuchContextBuilder::new(account_config.clone(), Arc::new(notmuch_config));
let ctx =
NotmuchContextBuilder::new(account_config.clone(), Arc::new(notmuch_config));
BackendBuilder::new(account_config.clone(), ctx)
.check_up()
.await?;
}
_ => (),
}
let sending_backend = toml_account_config
.message
.and_then(|msg| msg.send)
.and_then(|send| send.backend);
match sending_backend {
#[cfg(feature = "smtp")]
if let Some(smtp_config) = toml_account_config.smtp {
printer.log("Checking SMTP integrity…")?;
Some(SendingBackend::Smtp(smtp_config)) => {
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 {
Some(SendingBackend::Sendmail(sendmail_config)) => {
printer.log("Checking Sendmail integrity…")?;
let ctx =
@ -93,6 +103,8 @@ impl AccountCheckUpCommand {
.check_up()
.await?;
}
_ => (),
}
printer.out("Checkup successfully completed!")
}

View file

@ -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) => {
match toml_account_config.imap_auth_config() {
Some(ImapAuthConfig::Password(config)) => {
config
.configure(|| Ok(prompt::password("IMAP password")?))
.await
}
#[cfg(feature = "oauth2")]
ImapAuthConfig::OAuth2(config) => {
Some(ImapAuthConfig::OAuth2(config)) => {
config
.configure(|| Ok(prompt::secret("IMAP OAuth 2.0 client secret")?))
.await
}
ImapAuthConfig::MissingOAuth2Feature => unreachable!(),
_ => Ok(()),
}?;
}
#[cfg(feature = "smtp")]
if let Some(config) = &toml_account_config.smtp {
match &config.auth {
SmtpAuthConfig::Passwd(config) => {
match toml_account_config.smtp_auth_config() {
Some(SmtpAuthConfig::Passwd(config)) => {
config
.configure(|| Ok(prompt::password("SMTP password")?))
.await
}
#[cfg(feature = "oauth2")]
SmtpAuthConfig::OAuth2(config) => {
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?;

View file

@ -1,4 +1,3 @@
#[cfg(feature = "wizard")]
use pimalaya_tui::himalaya::config::HimalayaTomlConfig;
pub type TomlConfig = HimalayaTomlConfig;

View file

@ -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()

View file

@ -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()