Skip to content

Commit

Permalink
bump all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Oct 29, 2024
1 parent 3a4bcd6 commit ea9945a
Show file tree
Hide file tree
Showing 19 changed files with 1,361 additions and 960 deletions.
1,890 changes: 1,170 additions & 720 deletions Cargo.lock

Large diffs are not rendered by default.

31 changes: 12 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ repository = "https://github.com/soywod/neverest/"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs", "--document-private-items"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
default = [
"imap",
"maildir",
# "notmuch",

# "keyring",
# "oauth2",
#"notmuch",
#"keyring",
#"oauth2",
"wizard",
]

imap = ["email-lib/imap", "pimalaya-tui/imap"]
maildir = ["email-lib/maildir", "pimalaya-tui/maildir"]
notmuch = ["email-lib/notmuch", "pimalaya-tui/notmuch"]

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:console", "dep:secret-lib", "email-lib/autoconfig"]
wizard = ["dep:console", "dep:secret-lib", "email-lib/autoconfig", "pimalaya-tui/wizard"]

[dependencies]
async-trait = "0.1"
clap = { version = "4.4", features = ["derive", "wrap_help"] }
clap_complete = "4.4"
clap_mangen = "0.2"
color-eyre = "0.6"
email-lib = { version = "=0.25.0", default-features = false, features = ["sync", "derive"] }
oauth-lib = { version = "=0.1.1", optional = true }
email-lib = { version = "=0.26.0", default-features = false, features = ["tokio-rustls", "sync", "derive"] }
oauth-lib = { version = "1", optional = true }
once_cell = "1.16"
pimalaya-tui = { version = "=0.1.0", default-features = false, features = ["path", "cli", "config", "tracing"] }
secret-lib = { version = "=0.4.6", optional = true, features = ["derive"] }
pimalaya-tui = { version = "=0.1", default-features = false, features = ["path", "cli", "config", "tracing"] }
secret-lib = { version = "1", optional = true, features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1.23", default-features = false, features = ["macros", "rt-multi-thread"] }
Expand All @@ -55,16 +55,9 @@ console = { version = "0.15.2", optional = true }
indicatif = "0.17"

[patch.crates-io]
# IMAP
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" }
keyring-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
mml-lib = { git = "https://github.com/pimalaya/core" }
pimalaya-tui = { git = "https://github.com/pimalaya/tui" }
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ You can also manually edit your own configuration, from scratch:
</details>

<details>
<summary>How the wizard discovers IMAP/SMTP configs?</summary>
<summary>How the wizard discovers IMAP configs?</summary>

All the lookup mechanisms use the email address domain as base for the lookup. It is heavily inspired from the Thunderbird [Autoconfiguration](https://udn.realityripple.com/docs/Mozilla/Thunderbird/Autoconfiguration) protocol. For example, for the email address `test@example.com`, the lookup is performed as (in this order):

Expand All @@ -434,12 +434,13 @@ You can also manually edit your own configuration, from scratch:

## Sponsoring

[![nlnet](https://nlnet.nl/logo/banner-160x60.png)](https://nlnet.nl/project/Pimalaya/index.html)
[![nlnet](https://nlnet.nl/logo/banner-160x60.png)](https://nlnet.nl/)

Special thanks to the [NLnet foundation](https://nlnet.nl/project/Pimalaya/index.html) and the [European Commission](https://www.ngi.eu/) that helped the project to receive financial support from:
Special thanks to the [NLnet foundation](https://nlnet.nl/) and the [European Commission](https://www.ngi.eu/) that helped the project to receive financial support from various programs:

- [NGI Assure](https://nlnet.nl/assure/) in 2022
- [NGI Zero Entrust](https://nlnet.nl/entrust/) in 2023
- [NGI Assure](https://nlnet.nl/project/Himalaya/) in 2022
- [NGI Zero Entrust](https://nlnet.nl/project/Pimalaya/) in 2023
- [NGI Zero Core](https://nlnet.nl/project/Pimalaya-PIM/) in 2024 *(still ongoing)*

If you appreciate the project, feel free to donate using one of the following providers:

Expand Down
5 changes: 5 additions & 0 deletions config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ right.backend.host = "localhost"
#right.backend.port = 143
right.backend.port = 993

# Defines the number of active IMAP clients during sync. A higher
# number consumes more resource but makes the sync faster.
#
right.backend.clients-pool-size = 4

# IMAP server encryption
#
#right.backend.encryption = "none" # or false
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 13 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
aarch64-linux = rec {
rustTarget = "aarch64-unknown-linux-musl";
runner = { pkgs, neverest }: "${pkgs.qemu}/bin/qemu-aarch64 ${neverest}";
mkPackage = { system, pkgs }: package:
mkPackage = { system, ... }: package:
let
inherit (mkPkgsCross system rustTarget) stdenv;
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
Expand All @@ -53,7 +53,7 @@
runner = { pkgs, neverest }:
let wine = pkgs.wine.override { wineBuild = "wine64"; };
in "${wine}/bin/wine64 ${neverest}.exe";
mkPackage = { system, pkgs }: package:
mkPackage = { pkgs, ... }: package:
let
inherit (pkgs.pkgsCross.mingwW64) stdenv windows;
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
Expand All @@ -66,52 +66,21 @@
};
};

aarch64-linux = {
aarch64-linux = {
rustTarget = "aarch64-unknown-linux-musl";
};
aarch64-linux.aarch64-linux = {
rustTarget = "aarch64-unknown-linux-musl";
};

x86_64-darwin = {
x86_64-darwin = {
rustTarget = "x86_64-apple-darwin";
mkPackage = { pkgs, ... }: package:
let inherit (pkgs.darwin.apple_sdk.frameworks) AppKit Cocoa;
in package // {
buildInputs = [ Cocoa ];
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
};
};

# FIXME: https://github.com/NixOS/nixpkgs/issues/273442
aarch64-darwin = {
rustTarget = "aarch64-apple-darwin";
runner = { pkgs, neverest }: "${pkgs.qemu}/bin/qemu-aarch64 ${neverest}";
mkPackage = { system, pkgs }: package:
let
inherit ((mkPkgsCross system "aarch64-darwin").pkgsStatic) stdenv darwin;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
in
package // {
buildInputs = [ Cocoa ];
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
TARGET_CC = cc;
CARGO_BUILD_RUSTFLAGS = package.CARGO_BUILD_RUSTFLAGS ++ [ "-Clinker=${cc}" ];
};
};
x86_64-darwin.x86_64-darwin = {
rustTarget = "x86_64-apple-darwin";
mkPackage = { pkgs, ... }: package:
let inherit (pkgs.darwin.apple_sdk_11_0.frameworks) Security;
in package // {
NIX_LDFLAGS = "-F${Security}/Library/Frameworks -framework Security";
};
};

aarch64-darwin = {
aarch64-darwin = {
rustTarget = "aarch64-apple-darwin";
mkPackage = { pkgs, ... }: package:
let inherit (pkgs.darwin.apple_sdk.frameworks) AppKit Cocoa;
in package // {
buildInputs = [ Cocoa ];
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
};
};
aarch64-darwin.aarch64-darwin = {
rustTarget = "aarch64-apple-darwin";
};
};

Expand Down
12 changes: 6 additions & 6 deletions src/account/command/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use color_eyre::eyre::Result;
use email::imap::config::ImapAuthConfig;
#[cfg(feature = "smtp")]
use email::smtp::config::SmtpAuthConfig;
use pimalaya_tui::{cli::printer::Printer, prompt};
use pimalaya_tui::terminal::{cli::printer::Printer, config::TomlConfig as _, prompt};
use tracing::{debug, info, instrument, warn};

use crate::{
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::Config,
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::TomlConfig,
};

/// Configure an account.
Expand All @@ -31,10 +31,10 @@ pub struct ConfigureAccountCommand {

impl ConfigureAccountCommand {
#[instrument(skip_all)]
pub async fn execute(self, printer: &mut impl Printer, config: &Config) -> Result<()> {
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
info!("executing configure account command");

let (name, config) = config.into_account_config(self.account.name.as_deref())?;
let (name, config) = config.to_toml_account_config(self.account.name.as_deref())?;

if self.reset {
let reset = match &config.left.backend {
Expand Down Expand Up @@ -63,7 +63,7 @@ impl ConfigureAccountCommand {
match &config.left.backend {
#[cfg(feature = "imap")]
BackendConfig::Imap(config) => match &config.auth {
ImapAuthConfig::Passwd(config) => {
ImapAuthConfig::Password(config) => {
config
.configure(|| Ok(prompt::password("Left IMAP password")?))
.await?;
Expand All @@ -81,7 +81,7 @@ impl ConfigureAccountCommand {
match &config.right.backend {
#[cfg(feature = "imap")]
BackendConfig::Imap(config) => match &config.auth {
ImapAuthConfig::Passwd(config) => {
ImapAuthConfig::Password(config) => {
config
.configure(|| Ok(prompt::password("Right IMAP password")?))
.await?;
Expand Down
8 changes: 4 additions & 4 deletions src/account/command/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use email::imap::ImapContextBuilder;
use email::maildir::MaildirContextBuilder;
#[cfg(feature = "notmuch")]
use email::notmuch::NotmuchContextBuilder;
use pimalaya_tui::cli::printer::Printer;
use pimalaya_tui::terminal::{cli::printer::Printer, config::TomlConfig as _};
use tracing::{info, instrument};

use crate::{
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::Config,
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::TomlConfig,
};

/// Check up the given account.
Expand All @@ -34,10 +34,10 @@ pub struct DoctorAccountCommand {

impl DoctorAccountCommand {
#[instrument(skip_all)]
pub async fn execute(self, printer: &mut impl Printer, config: &Config) -> Result<()> {
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
info!("executing doctor account command");

let (name, config) = config.into_account_config(self.account.name.as_deref())?;
let (name, config) = config.to_toml_account_config(self.account.name.as_deref())?;
printer.log(format!("Checking `{name}` account integrity…"))?;

let folder_filter = config.folder.map(|c| c.filters).unwrap_or_default();
Expand Down
30 changes: 19 additions & 11 deletions src/account/command/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use email::{
};
use indicatif::{MultiProgress, ProgressBar, ProgressFinish, ProgressStyle};
use once_cell::sync::Lazy;
use pimalaya_tui::cli::printer::Printer;
use pimalaya_tui::terminal::{cli::printer::Printer, config::TomlConfig as _};
use tracing::{info, instrument};

use crate::{
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::Config,
account::arg::name::OptionalAccountNameArg, backend::config::BackendConfig, config::TomlConfig,
};

static MAIN_PROGRESS_STYLE: Lazy<ProgressStyle> = Lazy::new(|| {
Expand Down Expand Up @@ -90,24 +90,32 @@ pub struct SynchronizeAccountCommand {

impl SynchronizeAccountCommand {
#[instrument(skip_all)]
pub async fn execute(self, printer: &mut impl Printer, config: &Config) -> Result<()> {
pub async fn execute(self, printer: &mut impl Printer, config: &TomlConfig) -> Result<()> {
info!("executing synchronize backends command");

let (name, config) = config.into_account_config(self.account.name.as_deref())?;
let (name, toml_account_config) =
config.to_toml_account_config(self.account.name.as_deref())?;

let folder_filter = config.folder.map(|c| c.filters).unwrap_or_default();
let envelope_filter = config.envelope.map(|c| c.filters).unwrap_or_default();
let folder_filter = toml_account_config
.folder
.map(|c| c.filters)
.unwrap_or_default();
let envelope_filter = toml_account_config
.envelope
.map(|c| c.filters)
.unwrap_or_default();

let (left_backend, left_config) = config.left.into_account_config(
let (left_backend, left_config) = toml_account_config.left.into_account_config(
name.clone(),
folder_filter.clone(),
envelope_filter.clone(),
);

let (right_backend, right_config) =
config
.right
.into_account_config(name.clone(), folder_filter, envelope_filter);
let (right_backend, right_config) = toml_account_config.right.into_account_config(
name.clone(),
folder_filter,
envelope_filter,
);

match left_backend {
BackendConfig::None => {
Expand Down
4 changes: 2 additions & 2 deletions src/account/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::backend::config::BackendGlobalConfig;
/// The account configuration.
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub struct AccountConfig {
pub struct TomlAccountConfig {
/// The defaultness of the current account.
///
/// When synchronizing, if no account name is explicitly given,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub struct AccountConfig {
pub right: BackendGlobalConfig,
}

impl AccountConfig {
impl TomlAccountConfig {
/// Configure the current account configuration.
///
/// This function is mostly used to replace undefined keyring
Expand Down
8 changes: 4 additions & 4 deletions src/account/wizard.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use color_eyre::eyre::Result;
use pimalaya_tui::prompt;
use pimalaya_tui::terminal::prompt;

use crate::backend::{self, BackendSource};

use super::config::AccountConfig;
use super::config::TomlAccountConfig;

pub async fn configure() -> Result<(String, AccountConfig)> {
pub async fn configure() -> Result<(String, TomlAccountConfig)> {
let name = prompt::text("Account name:", Some("personal"))?;

let config = AccountConfig {
let config = TomlAccountConfig {
default: Some(true),
folder: None,
envelope: None,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/wizard.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use color_eyre::eyre::Result;
use email::autoconfig;
use pimalaya_tui::{prompt, wizard};
use pimalaya_tui::terminal::{prompt, wizard};

use crate::backend::config::BackendConfig;

Expand Down
Loading

0 comments on commit ea9945a

Please sign in to comment.