mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Use system certs when using openssl
This commit is contained in:
parent
3ae6fe4a1a
commit
18f891efd2
3 changed files with 77 additions and 11 deletions
67
Cargo.lock
generated
67
Cargo.lock
generated
|
|
@ -344,6 +344,16 @@ dependencies = [
|
|||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.4"
|
||||
|
|
@ -391,6 +401,7 @@ dependencies = [
|
|||
"num_cpus",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"rustls-native-certs",
|
||||
"sanitize-filename",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
@ -403,9 +414,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crunchyroll-rs"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6560e2f721420854d34b94b8bc35b316e3ff6bc83cb7cbf24750ddf55a21d45a"
|
||||
checksum = "771cd92c5a4cc050f301674d77bca6c23f8f260ef346bd06c11b4b05ab9e0166"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"async-trait",
|
||||
|
|
@ -430,9 +441,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crunchyroll-rs-internal"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1398807cd10094f08c1d31423f7979e74c25f772c203d477dfa6ddc4ceb81f2"
|
||||
checksum = "b260191f1125c7ba31e35071524938de5c6b0c2d248e5a35c62c4605e2da427e"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"quote",
|
||||
|
|
@ -1244,9 +1255,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
|||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.12"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
|
@ -1465,6 +1476,18 @@ dependencies = [
|
|||
"sct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
|
||||
dependencies = [
|
||||
"openssl-probe",
|
||||
"rustls-pemfile",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "1.0.3"
|
||||
|
|
@ -1500,6 +1523,15 @@ dependencies = [
|
|||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.0"
|
||||
|
|
@ -1510,6 +1542,29 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.186"
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
|
||||
[features]
|
||||
openssl = ["reqwest/native-tls-alpn"]
|
||||
openssl-static = ["reqwest/native-tls-alpn", "reqwest/native-tls-vendored"]
|
||||
openssl = ["reqwest/native-tls-alpn", "dep:rustls-native-certs"]
|
||||
openssl-static = ["reqwest/native-tls-alpn", "reqwest/native-tls-vendored", "dep:rustls-native-certs"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
async-trait = "0.1"
|
||||
clap = { version = "4.3", features = ["derive", "string"] }
|
||||
chrono = "0.4"
|
||||
crunchyroll-rs = { version = "0.6.1", features = ["dash-stream"] }
|
||||
crunchyroll-rs = { version = "0.6.2", features = ["dash-stream"] }
|
||||
ctrlc = "3.4"
|
||||
dialoguer = { version = "0.10", default-features = false }
|
||||
dirs = "5.0"
|
||||
|
|
@ -31,9 +31,10 @@ serde = "1.0"
|
|||
serde_json = "1.0"
|
||||
serde_plain = "1.0"
|
||||
shlex = "1.1"
|
||||
sys-locale = "0.3"
|
||||
tempfile = "3.7"
|
||||
tokio = { version = "1.31", features = ["macros", "rt-multi-thread", "time"] }
|
||||
sys-locale = "0.3"
|
||||
rustls-native-certs = { version = "0.6", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
chrono = "0.4"
|
||||
|
|
|
|||
|
|
@ -271,7 +271,17 @@ async fn crunchyroll_session(cli: &mut Cli) -> Result<Crunchyroll> {
|
|||
CrunchyrollBuilder::predefined_client_builder()
|
||||
};
|
||||
#[cfg(any(feature = "openssl", feature = "openssl-static"))]
|
||||
let client = builder.use_native_tls().build().unwrap();
|
||||
let client = {
|
||||
let mut builder = builder.use_native_tls().tls_built_in_root_certs(false);
|
||||
|
||||
for certificate in rustls_native_certs::load_native_certs().unwrap() {
|
||||
builder = builder.add_root_certificate(
|
||||
reqwest::Certificate::from_der(certificate.0.as_slice()).unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
builder.build().unwrap()
|
||||
};
|
||||
#[cfg(not(any(feature = "openssl", feature = "openssl-static")))]
|
||||
let client = builder.build().unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue