Skip to content

Commit 2ff3ed3

Browse files
committed
Update dependencies and version
1 parent b8bb3b4 commit 2ff3ed3

File tree

9 files changed

+38
-32
lines changed

9 files changed

+38
-32
lines changed

Cargo.toml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "crunchyroll-rs"
3-
version = "0.8.3"
3+
version = "0.8.4"
44
authors = ["Crunchy Labs Maintainers"]
55
edition = "2021"
66
description = "Pure Rust implementation of the crunchyroll api."
@@ -29,26 +29,27 @@ __test_strict = []
2929

3030
[dependencies]
3131
async-trait = "0.1"
32-
chrono = { version = "0.4", features = ["serde"] }
32+
# chrono introduced the try_* methods in version 0.4.32 and deprecated all non try_* methods in version 0.4.35
33+
chrono = { version = ">=0.4.32", features = ["serde"] }
3334
futures-util = { version = "0.3", features = ["std"], default-features = false }
3435
jsonwebtoken = { version = "9.2", default-features = false }
3536
# the patch version number is necessary for the 'reqwest' and 'rustls' dependencies to prevent incompatability errors
3637
# (https://github.com/seanmonstar/reqwest/issues/1837)
37-
reqwest = { version = "0.11.23", features = ["cookies", "json", "rustls-tls"], default-features = false }
38-
rustls = { version = "0.21.6", features = ["dangerous_configuration"] }
38+
reqwest = { version = "0.11.25", features = ["cookies", "json", "rustls-tls"], default-features = false }
39+
rustls = "0.22.2"
3940
serde = { version = "1.0", features = ["derive"] }
4041
serde_json = "1.0"
4142
serde_urlencoded = "0.7"
4243
smart-default = "0.7"
43-
tokio = { version = "1.35", features = ["sync"] }
44+
tokio = { version = "1.36", features = ["sync"] }
4445
webpki-roots = "0.26"
4546

46-
crunchyroll-rs-internal = { version = "0.8.3", path = "internal" }
47+
crunchyroll-rs-internal = { version = "0.8.4", path = "internal" }
4748

4849
# Optional / required from features
4950
aes = { version = "0.8", optional = true }
5051
cbc = { version = "0.1", optional = true }
51-
dash-mpd = { version = "0.14", default-features = false, optional = true }
52+
dash-mpd = { version = "0.15", default-features = false, optional = true }
5253
lazy_static = { version = "1.4", optional = true }
5354
m3u8-rs = { version = "6.0", optional = true }
5455
regex = { version = "1.10", default-features = false, features = ["std"], optional = true }
@@ -58,7 +59,7 @@ tower-service = { version = "0.3", optional = true }
5859
anyhow = "1.0"
5960
once_cell = "1.19"
6061
rand = "0.8"
61-
tokio = { version = "1.35", features = ["macros", "rt", "rt-multi-thread"] }
62+
tokio = { version = "1.36", features = ["macros", "rt", "rt-multi-thread"] }
6263

6364
[workspace]
6465
members = ["internal"]

internal/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "crunchyroll-rs-internal"
3-
version = "0.8.3"
3+
version = "0.8.4"
44
authors = ["Crunchy Labs Maintainers"]
55
edition = "2021"
66
description = "Internal crate for crunchyroll-rs. Do not use."

src/crunchyroll.rs

+21-16
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ mod auth {
301301
}
302302
SessionToken::Anonymous => SessionToken::Anonymous,
303303
};
304-
new_config.session_expire =
305-
Utc::now().add(Duration::seconds(login_response.expires_in as i64));
304+
new_config.session_expire = Utc::now()
305+
.add(Duration::try_seconds(login_response.expires_in as i64).unwrap());
306306

307307
*config = new_config;
308308
}
@@ -588,20 +588,25 @@ mod auth {
588588
/// to set your built client.
589589
pub fn predefined_client_builder() -> ClientBuilder {
590590
let mut root_store = rustls::RootCertStore::empty();
591-
root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
592-
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
593-
ta.subject.to_vec(),
594-
ta.subject_public_key_info.to_vec(),
595-
ta.name_constraints.clone().map(|nc| nc.to_vec()),
591+
root_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
592+
593+
let tls_config = rustls::ClientConfig::builder_with_protocol_versions(&[
594+
&rustls::version::TLS12,
595+
&rustls::version::TLS13,
596+
])
597+
.with_webpki_verifier(
598+
rustls::client::WebPkiServerVerifier::builder_with_provider(
599+
root_store.into(),
600+
rustls::crypto::CryptoProvider {
601+
kx_groups: vec![rustls::crypto::ring::kx_group::X25519],
602+
..rustls::crypto::ring::default_provider()
603+
}
604+
.into(),
596605
)
597-
}));
598-
let tls_config = rustls::ClientConfig::builder()
599-
.with_cipher_suites(rustls::DEFAULT_CIPHER_SUITES)
600-
.with_kx_groups(&[&rustls::kx_group::X25519])
601-
.with_protocol_versions(&[&rustls::version::TLS12, &rustls::version::TLS13])
602-
.unwrap()
603-
.with_root_certificates(root_store)
604-
.with_no_client_auth();
606+
.build()
607+
.unwrap(),
608+
)
609+
.with_no_client_auth();
605610

606611
Client::builder()
607612
.https_only(true)
@@ -854,7 +859,7 @@ mod auth {
854859
access_token: login_response.access_token,
855860
session_token,
856861
session_expire: Utc::now()
857-
.add(Duration::seconds(login_response.expires_in as i64)),
862+
.add(Duration::try_seconds(login_response.expires_in as i64).unwrap()),
858863
}),
859864
details: ExecutorDetails {
860865
locale: self.locale,

src/internal/serde.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub(crate) fn deserialize_millis_to_duration<'de, D>(deserializer: D) -> Result<
8282
where
8383
D: Deserializer<'de>,
8484
{
85-
Ok(Duration::milliseconds(i64::deserialize(deserializer)?))
85+
Ok(Duration::try_milliseconds(i64::deserialize(deserializer)?).unwrap())
8686
}
8787

8888
pub(crate) fn serialize_duration_to_millis<S>(

src/media/anime/episode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub struct Episode {
9090
#[serde(alias = "duration_ms")]
9191
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
9292
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
93-
#[default(Duration::milliseconds(0))]
93+
#[default(Duration::try_milliseconds(0).unwrap())]
9494
pub duration: Duration,
9595

9696
#[default(DateTime::<Utc>::from(std::time::SystemTime::UNIX_EPOCH))]

src/media/anime/movie.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct Movie {
3636
#[serde(alias = "duration_ms")]
3737
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
3838
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
39-
#[default(Duration::milliseconds(0))]
39+
#[default(Duration::try_milliseconds(0).unwrap())]
4040
pub duration: Duration,
4141

4242
pub images: ThumbnailImages,

src/media/music/artist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ pub struct Artist {
8181
#[serde(alias = "totalConcertDurationMs")]
8282
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
8383
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
84-
#[default(Duration::milliseconds(0))]
84+
#[default(Duration::try_milliseconds(0).unwrap())]
8585
pub total_concert_duration: Duration,
8686
#[serde(alias = "totalVideoDurationMs")]
8787
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
8888
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
89-
#[default(Duration::milliseconds(0))]
89+
#[default(Duration::try_milliseconds(0).unwrap())]
9090
pub total_video_duration: Duration,
9191

9292
pub images: PosterImages,

src/media/music/concert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct Concert {
5151
#[serde(alias = "durationMs")]
5252
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
5353
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
54-
#[default(Duration::milliseconds(0))]
54+
#[default(Duration::try_milliseconds(0).unwrap())]
5555
pub duration: Duration,
5656
#[default(DateTime::<Utc>::from(std::time::SystemTime::UNIX_EPOCH))]
5757
pub original_release: DateTime<Utc>,

src/media/music/music_video.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct MusicVideo {
5555
#[serde(alias = "durationMs")]
5656
#[serde(deserialize_with = "crate::internal::serde::deserialize_millis_to_duration")]
5757
#[serde(serialize_with = "crate::internal::serde::serialize_duration_to_millis")]
58-
#[default(Duration::milliseconds(0))]
58+
#[default(Duration::try_milliseconds(0).unwrap())]
5959
pub duration: Duration,
6060

6161
#[default(DateTime::<Utc>::from(std::time::SystemTime::UNIX_EPOCH))]

0 commit comments

Comments
 (0)