mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Fix invalid Windows client builder
This commit is contained in:
parent
f687969f04
commit
f6d6c9435c
1 changed files with 9 additions and 6 deletions
|
|
@ -164,24 +164,27 @@ pub async fn cli_entrypoint() {
|
||||||
|
|
||||||
async fn create_ctx(cli: &Cli) -> Result<Context> {
|
async fn create_ctx(cli: &Cli) -> Result<Context> {
|
||||||
let crunchy = crunchyroll_session(cli).await?;
|
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
|
// 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
|
// where crunchy stores their videos can't handle this bypass and simply refuses to connect
|
||||||
#[cfg(not(all(windows, target_env = "msvc")))]
|
#[cfg(not(all(windows, target_env = "msvc")))]
|
||||||
let client = isahc::HttpClient::new().unwrap();
|
let client = isahc::HttpClient::new().unwrap();
|
||||||
#[cfg(all(windows, target_env = "msvc"))]
|
#[cfg(all(windows, target_env = "msvc"))]
|
||||||
|
use isahc::config::Configurable;
|
||||||
|
#[cfg(all(windows, target_env = "msvc"))]
|
||||||
let client = isahc::HttpClientBuilder::default()
|
let client = isahc::HttpClientBuilder::default()
|
||||||
.tls_config(
|
.tls_config(
|
||||||
isahc::tls::TlsConfigBuilder::default().root_cert_store(
|
isahc::tls::TlsConfigBuilder::default()
|
||||||
isahc::tls::RootCertStore::custom(
|
.root_cert_store(isahc::tls::RootCertStore::custom(
|
||||||
rustls_native_certs::load_native_certs()
|
rustls_native_certs::load_native_certs()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|l| isahc::tls::Certificate::from_der(l.0)),
|
.map(|l| isahc::tls::Certificate::from_der(l.0)),
|
||||||
),
|
))
|
||||||
),
|
.build(),
|
||||||
)
|
)
|
||||||
.build();
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
Ok(Context { crunchy, client })
|
Ok(Context { crunchy, client })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue