partially fix minimal builds

This commit is contained in:
Toshit Chawda 2024-08-31 22:32:28 -07:00
parent f0293c53f1
commit 807bbe18e9
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
3 changed files with 9 additions and 10 deletions

View file

@ -53,7 +53,7 @@ AUTOGENERATED_SNIPPET_PATH=${AUTOGENERATED_SNIPPET_PATH#*$'\''}
AUTOGENERATED_SNIPPET_PATH=${AUTOGENERATED_SNIPPET_PATH%%$'\''*} AUTOGENERATED_SNIPPET_PATH=${AUTOGENERATED_SNIPPET_PATH%%$'\''*}
# replace a dot at the start of the var with out # replace a dot at the start of the var with out
AUTOGENERATED_SNIPPET=$(base64 -w0 ${AUTOGENERATED_SNIPPET_PATH/#./out}) AUTOGENERATED_SNIPPET=$(base64 -w0 "${AUTOGENERATED_SNIPPET_PATH/#./out}")
AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//${AUTOGENERATED_SNIPPET_PATH}/data:application/javascript$';'base64,${AUTOGENERATED_SNIPPET}} AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//${AUTOGENERATED_SNIPPET_PATH}/data:application/javascript$';'base64,${AUTOGENERATED_SNIPPET}}
@ -77,7 +77,7 @@ echo "$AUTOGENERATED_SOURCE" > pkg/epoxy.js
echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy.js echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy.js
WASM_BASE64=$(base64 -w0 out/epoxy_client_bg.wasm) WASM_BASE64=$(base64 -w0 out/epoxy_client_bg.wasm)
AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//__wbg_init(module_or_path, memory) \{/__wbg_init(module_or_path, memory) \{$'\n\t'module_or_path ||= $'{};\n\t'module_or_path.module_or_path=\'data:application/wasm;base64,$WASM_BASE64\'} AUTOGENERATED_SOURCE=${AUTOGENERATED_SOURCE//__wbg_init(module_or_path, memory) \{/__wbg_init(module_or_path, memory) \{$'\n\t'module_or_path ||= $'{};\n\t'module_or_path.module_or_path=new URL(\'data:application/wasm;base64,$WASM_BASE64\')}
echo "$AUTOGENERATED_SOURCE" > pkg/epoxy-bundled.js echo "$AUTOGENERATED_SOURCE" > pkg/epoxy-bundled.js
echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy-bundled.js echo "$AUTOGENERATED_INFO_FUNC" >> pkg/epoxy-bundled.js

View file

@ -348,7 +348,10 @@ impl EpoxyClient {
client, client,
redirect_limit: options.redirect_limit, redirect_limit: options.redirect_limit,
user_agent: options.user_agent, user_agent: options.user_agent,
#[cfg(feature = "full")]
certs_tampered: !options.pem_files.is_empty(), certs_tampered: !options.pem_files.is_empty(),
#[cfg(not(feature = "full"))]
certs_tampered: false,
}) })
} }

View file

@ -1,5 +1,5 @@
use std::{ use std::{
io::{BufReader, ErrorKind}, io::{ErrorKind},
pin::Pin, pin::Pin,
sync::Arc, sync::Arc,
task::Poll, task::Poll,
@ -7,7 +7,7 @@ use std::{
use cfg_if::cfg_if; use cfg_if::cfg_if;
use futures_rustls::{ use futures_rustls::{
rustls::{crypto::ring::default_provider, ClientConfig, RootCertStore}, rustls::{ClientConfig, RootCertStore},
TlsConnector, TlsConnector,
}; };
use futures_util::{ use futures_util::{
@ -25,11 +25,7 @@ use wisp_mux::{
ClientMux, MuxStreamAsyncRW, MuxStreamIo, StreamType, ClientMux, MuxStreamAsyncRW, MuxStreamIo, StreamType,
}; };
use crate::{ use crate::{console_log, utils::IgnoreCloseNotify, EpoxyClientOptions, EpoxyError};
console_log,
utils::{IgnoreCloseNotify, NoCertificateVerification},
EpoxyClientOptions, EpoxyError,
};
pub type ProviderUnencryptedStream = MuxStreamIo; pub type ProviderUnencryptedStream = MuxStreamIo;
pub type ProviderUnencryptedAsyncRW = MuxStreamAsyncRW; pub type ProviderUnencryptedAsyncRW = MuxStreamAsyncRW;
@ -75,7 +71,7 @@ impl StreamProvider {
.pem_files .pem_files
.iter() .iter()
.flat_map(|x| { .flat_map(|x| {
rustls_pemfile::certs(&mut BufReader::new(x.as_bytes())) rustls_pemfile::certs(&mut std::io::BufReader::new(x.as_bytes()))
.map(|x| x.map(|x| webpki::anchor_from_trusted_cert(&x).map(|x| x.to_owned()))) .map(|x| x.map(|x| webpki::anchor_from_trusted_cert(&x).map(|x| x.to_owned())))
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })