mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
update dependencies, including iroh to 0.1.1
This commit is contained in:
2686
Cargo.lock
generated
2686
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ version = "1.101.0"
|
|||||||
authors = ["Delta Chat Developers (ML) <delta@codespeak.net>"]
|
authors = ["Delta Chat Developers (ML) <delta@codespeak.net>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
rust-version = "1.57"
|
rust-version = "1.63"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = 0
|
debug = 0
|
||||||
@@ -83,8 +83,8 @@ futures-lite = "1.12.0"
|
|||||||
tokio-stream = { version = "0.1.11", features = ["fs"] }
|
tokio-stream = { version = "0.1.11", features = ["fs"] }
|
||||||
reqwest = { version = "0.11.12", features = ["json"] }
|
reqwest = { version = "0.11.12", features = ["json"] }
|
||||||
async_zip = { version = "0.0.9", default-features = false, features = ["deflate"] }
|
async_zip = { version = "0.0.9", default-features = false, features = ["deflate"] }
|
||||||
iroh-share = { git = "https://github.com/n0-computer/iroh", branch = "main" }
|
iroh-share = { git = "https://github.com/n0-computer/iroh", tag = "v0.1.1" }
|
||||||
iroh-resolver = { git = "https://github.com/n0-computer/iroh", branch = "main", default-features = false }
|
iroh-resolver = { git = "https://github.com/n0-computer/iroh", tag = "v0.1.1", default-features = false }
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
multibase = "0.9"
|
multibase = "0.9"
|
||||||
port_check = "0.1.5"
|
port_check = "0.1.5"
|
||||||
@@ -155,4 +155,4 @@ vendored = [
|
|||||||
nightly = ["pgp/nightly"]
|
nightly = ["pgp/nightly"]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
libp2p = { git = "https://github.com/dignifiedquire/rust-libp2p", branch = "iroh" }
|
libp2p = { git = "https://github.com/dignifiedquire/rust-libp2p", branch = "iroh-0-50-1" }
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ anyhow = "1"
|
|||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
once_cell = "1.16.0"
|
once_cell = "1.16.0"
|
||||||
iroh-share = { git = "https://github.com/n0-computer/iroh", branch = "main" }
|
iroh-share = { git = "https://github.com/n0-computer/iroh", tag = "v0.1.1" }
|
||||||
multibase = "0.9"
|
multibase = "0.9"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.61.0
|
1.63.0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ set -euo pipefail
|
|||||||
#
|
#
|
||||||
# Avoid using rustup here as it depends on reading /proc/self/exe and
|
# Avoid using rustup here as it depends on reading /proc/self/exe and
|
||||||
# has problems running under QEMU.
|
# has problems running under QEMU.
|
||||||
RUST_VERSION=1.61.0
|
RUST_VERSION=1.63.0
|
||||||
|
|
||||||
ARCH="$(uname -m)"
|
ARCH="$(uname -m)"
|
||||||
test -f "/lib/libc.musl-$ARCH.so.1" && LIBC=musl || LIBC=gnu
|
test -f "/lib/libc.musl-$ARCH.so.1" && LIBC=musl || LIBC=gnu
|
||||||
|
|||||||
@@ -661,7 +661,8 @@ async fn import_backup(
|
|||||||
/// it can be renamed to dest_path. This guarantees that the backup is complete.
|
/// it can be renamed to dest_path. This guarantees that the backup is complete.
|
||||||
fn get_next_backup_path(folder: &Path, backup_time: i64) -> Result<(PathBuf, PathBuf, PathBuf)> {
|
fn get_next_backup_path(folder: &Path, backup_time: i64) -> Result<(PathBuf, PathBuf, PathBuf)> {
|
||||||
let folder = PathBuf::from(folder);
|
let folder = PathBuf::from(folder);
|
||||||
let stem = chrono::NaiveDateTime::from_timestamp(backup_time, 0)
|
let stem = chrono::NaiveDateTime::from_timestamp_opt(backup_time, 0)
|
||||||
|
.unwrap()
|
||||||
// Don't change this file name format, in `dc_imex_has_backup` we use string comparison to determine which backup is newer:
|
// Don't change this file name format, in `dc_imex_has_backup` we use string comparison to determine which backup is newer:
|
||||||
.format("delta-chat-backup-%Y-%m-%d")
|
.format("delta-chat-backup-%Y-%m-%d")
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|||||||
@@ -476,7 +476,8 @@ pub async fn get_kml(context: &Context, chat_id: ChatId) -> Result<(String, u32)
|
|||||||
|
|
||||||
fn get_kml_timestamp(utc: i64) -> String {
|
fn get_kml_timestamp(utc: i64) -> String {
|
||||||
// Returns a string formatted as YYYY-MM-DDTHH:MM:SSZ. The trailing `Z` indicates UTC.
|
// Returns a string formatted as YYYY-MM-DDTHH:MM:SSZ. The trailing `Z` indicates UTC.
|
||||||
chrono::NaiveDateTime::from_timestamp(utc, 0)
|
chrono::NaiveDateTime::from_timestamp_opt(utc, 0)
|
||||||
|
.unwrap()
|
||||||
.format("%Y-%m-%dT%H:%M:%SZ")
|
.format("%Y-%m-%dT%H:%M:%SZ")
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -531,7 +531,9 @@ impl<'a> MimeFactory<'a> {
|
|||||||
.push(Header::new("Subject".into(), encoded_subject));
|
.push(Header::new("Subject".into(), encoded_subject));
|
||||||
|
|
||||||
let date = chrono::Utc
|
let date = chrono::Utc
|
||||||
.from_local_datetime(&chrono::NaiveDateTime::from_timestamp(self.timestamp, 0))
|
.from_local_datetime(
|
||||||
|
&chrono::NaiveDateTime::from_timestamp_opt(self.timestamp, 0).unwrap(),
|
||||||
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_rfc2822();
|
.to_rfc2822();
|
||||||
headers.unprotected.push(Header::new("Date".into(), date));
|
headers.unprotected.push(Header::new("Date".into(), date));
|
||||||
@@ -1338,14 +1340,16 @@ async fn build_body_file(
|
|||||||
// etc.
|
// etc.
|
||||||
let filename_to_send: String = match msg.viewtype {
|
let filename_to_send: String = match msg.viewtype {
|
||||||
Viewtype::Voice => chrono::Utc
|
Viewtype::Voice => chrono::Utc
|
||||||
.timestamp(msg.timestamp_sort, 0)
|
.timestamp_opt(msg.timestamp_sort, 0)
|
||||||
|
.unwrap()
|
||||||
.format(&format!("voice-message_%Y-%m-%d_%H-%M-%S.{}", &suffix))
|
.format(&format!("voice-message_%Y-%m-%d_%H-%M-%S.{}", &suffix))
|
||||||
.to_string(),
|
.to_string(),
|
||||||
Viewtype::Image | Viewtype::Gif => format!(
|
Viewtype::Image | Viewtype::Gif => format!(
|
||||||
"{}.{}",
|
"{}.{}",
|
||||||
if base_name.is_empty() {
|
if base_name.is_empty() {
|
||||||
chrono::Utc
|
chrono::Utc
|
||||||
.timestamp(msg.timestamp_sort, 0)
|
.timestamp_opt(msg.timestamp_sort, 0)
|
||||||
|
.unwrap()
|
||||||
.format("image_%Y-%m-%d_%H-%M-%S")
|
.format("image_%Y-%m-%d_%H-%M-%S")
|
||||||
.to_string()
|
.to_string()
|
||||||
} else {
|
} else {
|
||||||
@@ -1356,7 +1360,8 @@ async fn build_body_file(
|
|||||||
Viewtype::Video => format!(
|
Viewtype::Video => format!(
|
||||||
"video_{}.{}",
|
"video_{}.{}",
|
||||||
chrono::Utc
|
chrono::Utc
|
||||||
.timestamp(msg.timestamp_sort, 0)
|
.timestamp_opt(msg.timestamp_sort, 0)
|
||||||
|
.unwrap()
|
||||||
.format("%Y-%m-%d_%H-%M-%S"),
|
.format("%Y-%m-%d_%H-%M-%S"),
|
||||||
&suffix
|
&suffix
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -184,7 +184,9 @@ pub fn get_provider_by_id(id: &str) -> Option<&'static Provider> {
|
|||||||
|
|
||||||
// returns update timestamp in seconds, UTC, compatible for comparison with time() and database times
|
// returns update timestamp in seconds, UTC, compatible for comparison with time() and database times
|
||||||
pub fn get_provider_update_timestamp() -> i64 {
|
pub fn get_provider_update_timestamp() -> i64 {
|
||||||
NaiveDateTime::new(*PROVIDER_UPDATED, NaiveTime::from_hms(0, 0, 0)).timestamp_millis() / 1_000
|
NaiveDateTime::new(*PROVIDER_UPDATED, NaiveTime::from_hms_opt(0, 0, 0).unwrap())
|
||||||
|
.timestamp_millis()
|
||||||
|
/ 1_000
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -260,8 +262,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_get_provider_update_timestamp() {
|
fn test_get_provider_update_timestamp() {
|
||||||
let timestamp_past = NaiveDateTime::new(
|
let timestamp_past = NaiveDateTime::new(
|
||||||
NaiveDate::from_ymd(2020, 9, 9),
|
NaiveDate::from_ymd_opt(2020, 9, 9).unwrap(),
|
||||||
NaiveTime::from_hms(0, 0, 0),
|
NaiveTime::from_hms_opt(0, 0, 0).unwrap(),
|
||||||
)
|
)
|
||||||
.timestamp_millis()
|
.timestamp_millis()
|
||||||
/ 1_000;
|
/ 1_000;
|
||||||
|
|||||||
@@ -1891,4 +1891,4 @@ pub(crate) static PROVIDER_IDS: Lazy<HashMap<&'static str, &'static Provider>> =
|
|||||||
});
|
});
|
||||||
|
|
||||||
pub static PROVIDER_UPDATED: Lazy<chrono::NaiveDate> =
|
pub static PROVIDER_UPDATED: Lazy<chrono::NaiveDate> =
|
||||||
Lazy::new(|| chrono::NaiveDate::from_ymd(2022, 7, 5));
|
Lazy::new(|| chrono::NaiveDate::from_ymd_opt(2022, 7, 5).unwrap());
|
||||||
|
|||||||
21
src/tools.rs
21
src/tools.rs
@@ -113,7 +113,7 @@ pub(crate) fn truncate_by_lines(
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
pub fn timestamp_to_str(wanted: i64) -> String {
|
pub fn timestamp_to_str(wanted: i64) -> String {
|
||||||
let ts = Local.timestamp(wanted, 0);
|
let ts = Local.timestamp_opt(wanted, 0).unwrap();
|
||||||
ts.format("%Y.%m.%d %H:%M:%S").to_string()
|
ts.format("%Y.%m.%d %H:%M:%S").to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,8 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
|
|||||||
stock_str::bad_time_msg_body(
|
stock_str::bad_time_msg_body(
|
||||||
context,
|
context,
|
||||||
Local
|
Local
|
||||||
.timestamp(now, 0)
|
.timestamp_opt(now, 0)
|
||||||
|
.unwrap()
|
||||||
.format("%Y-%m-%d %H:%M:%S")
|
.format("%Y-%m-%d %H:%M:%S")
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
@@ -218,7 +219,9 @@ async fn maybe_warn_on_bad_time(context: &Context, now: i64, known_past_timestam
|
|||||||
Some(
|
Some(
|
||||||
format!(
|
format!(
|
||||||
"bad-time-warning-{}",
|
"bad-time-warning-{}",
|
||||||
chrono::NaiveDateTime::from_timestamp(now, 0).format("%Y-%m-%d") // repeat every day
|
chrono::NaiveDateTime::from_timestamp_opt(now, 0)
|
||||||
|
.unwrap()
|
||||||
|
.format("%Y-%m-%d") // repeat every day
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
),
|
),
|
||||||
@@ -241,7 +244,9 @@ async fn maybe_warn_on_outdated(context: &Context, now: i64, approx_compile_time
|
|||||||
Some(
|
Some(
|
||||||
format!(
|
format!(
|
||||||
"outdated-warning-{}",
|
"outdated-warning-{}",
|
||||||
chrono::NaiveDateTime::from_timestamp(now, 0).format("%Y-%m") // repeat every month
|
chrono::NaiveDateTime::from_timestamp_opt(now, 0)
|
||||||
|
.unwrap()
|
||||||
|
.format("%Y-%m") // repeat every month
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
),
|
),
|
||||||
@@ -648,9 +653,9 @@ pub(crate) fn parse_receive_header(header: &str) -> String {
|
|||||||
if let Ok(date) = dateparse(&header) {
|
if let Ok(date) = dateparse(&header) {
|
||||||
// In tests, use the UTC timezone so that the test is reproducible
|
// In tests, use the UTC timezone so that the test is reproducible
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
let date_obj = chrono::Utc.timestamp(date, 0);
|
let date_obj = chrono::Utc.timestamp_opt(date, 0).unwrap();
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
let date_obj = Local.timestamp(date, 0);
|
let date_obj = Local.timestamp_opt(date, 0).unwrap();
|
||||||
|
|
||||||
hop_info += &format!("Date: {}", date_obj.to_rfc2822());
|
hop_info += &format!("Date: {}", date_obj.to_rfc2822());
|
||||||
};
|
};
|
||||||
@@ -1153,8 +1158,8 @@ DKIM Results: Passed=true, Works=true, Allow_Keychange=true";
|
|||||||
let timestamp_now = time();
|
let timestamp_now = time();
|
||||||
let timestamp_future = timestamp_now + 60 * 60 * 24 * 7;
|
let timestamp_future = timestamp_now + 60 * 60 * 24 * 7;
|
||||||
let timestamp_past = NaiveDateTime::new(
|
let timestamp_past = NaiveDateTime::new(
|
||||||
NaiveDate::from_ymd(2020, 9, 1),
|
NaiveDate::from_ymd_opt(2020, 9, 1).unwrap(),
|
||||||
NaiveTime::from_hms(0, 0, 0),
|
NaiveTime::from_hms_opt(0, 0, 0).unwrap(),
|
||||||
)
|
)
|
||||||
.timestamp_millis()
|
.timestamp_millis()
|
||||||
/ 1_000;
|
/ 1_000;
|
||||||
|
|||||||
Reference in New Issue
Block a user