DAV server passing Litmus test suite
This commit is contained in:
@@ -15,11 +15,12 @@ use clap::Parser;
|
||||
use console::style;
|
||||
use jmap_client::client::Credentials;
|
||||
use modules::{
|
||||
UnwrapResult,
|
||||
cli::{Cli, Client, Commands},
|
||||
is_localhost, UnwrapResult,
|
||||
is_localhost,
|
||||
};
|
||||
use reqwest::{header::AUTHORIZATION, Method, StatusCode};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use reqwest::{Method, StatusCode, header::AUTHORIZATION};
|
||||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||
|
||||
use crate::modules::OAuthResponse;
|
||||
|
||||
@@ -255,7 +256,9 @@ impl Client {
|
||||
return None;
|
||||
}
|
||||
StatusCode::UNAUTHORIZED => {
|
||||
eprintln!("Authentication failed. Make sure the credentials are correct and that the account has administrator rights.");
|
||||
eprintln!(
|
||||
"Authentication failed. Make sure the credentials are correct and that the account has administrator rights."
|
||||
);
|
||||
std::process::exit(1);
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -12,8 +12,8 @@ use reqwest::Method;
|
||||
use serde_json::Value;
|
||||
|
||||
use super::{
|
||||
cli::{AccountCommands, Client},
|
||||
Principal, PrincipalField, PrincipalUpdate, PrincipalValue, Type,
|
||||
cli::{AccountCommands, Client},
|
||||
};
|
||||
|
||||
impl AccountCommands {
|
||||
@@ -325,7 +325,7 @@ impl Client {
|
||||
if !results.items.is_empty() {
|
||||
let mut table = Table::new();
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new(&format!("{record_name} Name")).with_style(Attr::Bold)
|
||||
Cell::new(&format!("{record_name} Name")).with_style(Attr::Bold),
|
||||
]));
|
||||
|
||||
for item in &results.items {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use prettytable::{format, Attr, Cell, Row, Table};
|
||||
use prettytable::{Attr, Cell, Row, Table, format};
|
||||
use reqwest::Method;
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -102,7 +102,7 @@ impl DomainCommands {
|
||||
if !domains.items.is_empty() {
|
||||
let mut table = Table::new();
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new("Domain Name").with_style(Attr::Bold)
|
||||
Cell::new("Domain Name").with_style(Attr::Bold),
|
||||
]));
|
||||
|
||||
for domain in &domains.items {
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use futures::{stream::FuturesUnordered, StreamExt};
|
||||
use futures::{StreamExt, stream::FuturesUnordered};
|
||||
use jmap_client::{
|
||||
email::{self, Email},
|
||||
identity::{self, Identity},
|
||||
@@ -23,8 +23,9 @@ use tokio::io::AsyncWriteExt;
|
||||
use crate::modules::RETRY_ATTEMPTS;
|
||||
|
||||
use super::{
|
||||
UnwrapResult,
|
||||
cli::{Client, ExportCommands},
|
||||
name_to_id, UnwrapResult,
|
||||
name_to_id,
|
||||
};
|
||||
|
||||
impl ExportCommands {
|
||||
|
||||
@@ -12,8 +12,8 @@ use serde_json::Value;
|
||||
use crate::modules::{Principal, Type};
|
||||
|
||||
use super::{
|
||||
cli::{Client, GroupCommands},
|
||||
PrincipalField, PrincipalUpdate, PrincipalValue,
|
||||
cli::{Client, GroupCommands},
|
||||
};
|
||||
|
||||
impl GroupCommands {
|
||||
|
||||
@@ -9,14 +9,14 @@ use std::{
|
||||
io::{self, Cursor},
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc, Mutex,
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use console::style;
|
||||
use futures::{stream::FuturesUnordered, StreamExt};
|
||||
use futures::{StreamExt, stream::FuturesUnordered};
|
||||
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
|
||||
use jmap_client::{
|
||||
core::set::SetObject,
|
||||
@@ -30,7 +30,7 @@ use rand::Rng;
|
||||
use serde::de::DeserializeOwned;
|
||||
use tokio::{fs::File, io::AsyncReadExt};
|
||||
|
||||
use crate::modules::{name_to_id, UnwrapResult, RETRY_ATTEMPTS};
|
||||
use crate::modules::{RETRY_ATTEMPTS, UnwrapResult, name_to_id};
|
||||
|
||||
use super::{
|
||||
cli::{Client, ImportCommands, MailboxFormat},
|
||||
@@ -363,8 +363,7 @@ impl ImportCommands {
|
||||
total_imported.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
Err(_) if retry_count < RETRY_ATTEMPTS => {
|
||||
let backoff =
|
||||
rand::rng().random_range(50..=300);
|
||||
let backoff = rand::rng().random_range(50..=300);
|
||||
tokio::time::sleep(Duration::from_millis(backoff))
|
||||
.await;
|
||||
retry_count += 1;
|
||||
|
||||
@@ -12,8 +12,8 @@ use serde_json::Value;
|
||||
use crate::modules::{Principal, Type};
|
||||
|
||||
use super::{
|
||||
cli::{Client, ListCommands},
|
||||
PrincipalField, PrincipalUpdate, PrincipalValue,
|
||||
cli::{Client, ListCommands},
|
||||
};
|
||||
|
||||
impl ListCommands {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
*/
|
||||
|
||||
use super::{
|
||||
cli::{Client, QueueCommands},
|
||||
List,
|
||||
cli::{Client, QueueCommands},
|
||||
};
|
||||
use console::Term;
|
||||
use human_size::{Byte, SpecificSize};
|
||||
use mail_parser::DateTime;
|
||||
use prettytable::{format::Alignment, Attr, Cell, Row, Table};
|
||||
use prettytable::{Attr, Cell, Row, Table, format::Alignment};
|
||||
use reqwest::Method;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
@@ -204,13 +204,12 @@ impl QueueCommands {
|
||||
]));
|
||||
}
|
||||
for domain in &message.domains {
|
||||
table.add_row(Row::new(vec![Cell::new_align(
|
||||
&domain.name,
|
||||
Alignment::RIGHT,
|
||||
)
|
||||
.with_style(Attr::Bold)
|
||||
.with_style(Attr::Italic(true))
|
||||
.with_hspan(2)]));
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new_align(&domain.name, Alignment::RIGHT)
|
||||
.with_style(Attr::Bold)
|
||||
.with_style(Attr::Italic(true))
|
||||
.with_hspan(2),
|
||||
]));
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new("Status").with_style(Attr::Bold),
|
||||
Cell::new(domain.status.status()),
|
||||
@@ -259,11 +258,9 @@ impl QueueCommands {
|
||||
]));
|
||||
}
|
||||
} else {
|
||||
table.add_row(Row::new(vec![Cell::new_align(
|
||||
"-- Not found --",
|
||||
Alignment::CENTER,
|
||||
)
|
||||
.with_hspan(2)]));
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new_align("-- Not found --", Alignment::CENTER).with_hspan(2),
|
||||
]));
|
||||
}
|
||||
|
||||
eprintln!();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
use super::cli::{Client, ReportCommands, ReportFormat};
|
||||
use crate::modules::{queue::deserialize_datetime, List};
|
||||
use crate::modules::{List, queue::deserialize_datetime};
|
||||
use console::Term;
|
||||
use human_size::{Byte, SpecificSize};
|
||||
use mail_auth::{
|
||||
@@ -14,7 +14,7 @@ use mail_auth::{
|
||||
report::{self, tlsrpt::TlsReport},
|
||||
};
|
||||
use mail_parser::DateTime;
|
||||
use prettytable::{format, Attr, Cell, Row, Table};
|
||||
use prettytable::{Attr, Cell, Row, Table, format};
|
||||
use reqwest::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -197,11 +197,10 @@ impl ReportCommands {
|
||||
),
|
||||
]));
|
||||
} else {
|
||||
table.add_row(Row::new(vec![Cell::new_align(
|
||||
"-- Not found --",
|
||||
format::Alignment::CENTER,
|
||||
)
|
||||
.with_hspan(2)]));
|
||||
table.add_row(Row::new(vec![
|
||||
Cell::new_align("-- Not found --", format::Alignment::CENTER)
|
||||
.with_hspan(2),
|
||||
]));
|
||||
}
|
||||
|
||||
eprintln!();
|
||||
|
||||
Reference in New Issue
Block a user