From f6d6c9435c7b6c91001cfad4f53dd3cb7819be15 Mon Sep 17 00:00:00 2001 From: ByteDream Date: Wed, 30 Nov 2022 22:28:51 +0100 Subject: [PATCH] Fix invalid Windows client builder --- crunchy-cli-core/src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crunchy-cli-core/src/lib.rs b/crunchy-cli-core/src/lib.rs index d64dae5..a1e8381 100644 --- a/crunchy-cli-core/src/lib.rs +++ b/crunchy-cli-core/src/lib.rs @@ -164,24 +164,27 @@ pub async fn cli_entrypoint() { async fn create_ctx(cli: &Cli) -> Result { let crunchy = crunchyroll_session(cli).await?; - // TODO: Use crunchy.client() when it's possible + // use crunchy.client() when it's possible // currently crunchy.client() has a cloudflare bypass built-in to access crunchyroll. the servers // where crunchy stores their videos can't handle this bypass and simply refuses to connect #[cfg(not(all(windows, target_env = "msvc")))] let client = isahc::HttpClient::new().unwrap(); #[cfg(all(windows, target_env = "msvc"))] + use isahc::config::Configurable; + #[cfg(all(windows, target_env = "msvc"))] let client = isahc::HttpClientBuilder::default() .tls_config( - isahc::tls::TlsConfigBuilder::default().root_cert_store( - isahc::tls::RootCertStore::custom( + isahc::tls::TlsConfigBuilder::default() + .root_cert_store(isahc::tls::RootCertStore::custom( rustls_native_certs::load_native_certs() .unwrap() .into_iter() .map(|l| isahc::tls::Certificate::from_der(l.0)), - ), - ), + )) + .build(), ) - .build(); + .build() + .unwrap(); Ok(Context { crunchy, client }) }