Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bb6648654 |
@@ -284,7 +284,7 @@ pub async fn network_connect(
|
||||
address: String,
|
||||
username: String,
|
||||
event_rx: &mut UnboundedReceiver<Command>,
|
||||
gui_config: &ProxyOverides,
|
||||
proxy_overides: &ProxyOverides,
|
||||
) -> Result<(), Error> {
|
||||
info!("connecting");
|
||||
|
||||
|
||||
+2
-2
@@ -329,7 +329,7 @@ pub async fn network_connect(
|
||||
address: String,
|
||||
username: String,
|
||||
event_rx: &mut UnboundedReceiver<Command>,
|
||||
gui_config: &ProxyOverides,
|
||||
proxy_overides: &ProxyOverides,
|
||||
) -> Result<(), Error> {
|
||||
info!("connecting");
|
||||
|
||||
@@ -342,7 +342,7 @@ pub async fn network_connect(
|
||||
)
|
||||
.ey()?;
|
||||
|
||||
if let Some(server_hash) = &gui_config.cert_hash {
|
||||
if let Some(server_hash) = &proxy_overides.cert_hash {
|
||||
let hash = web_sys::js_sys::Uint8Array::from(server_hash.as_slice());
|
||||
web_sys::js_sys::Reflect::set(&object, &"value".into(), &hash).ey()?;
|
||||
}
|
||||
|
||||
+7
-7
@@ -77,7 +77,7 @@ async fn main() -> Result<()> {
|
||||
.install_default()
|
||||
.map_err(|e| anyhow!("could not install crypto provider {e:?}"))?;
|
||||
|
||||
let mut client_config = ProxyOverides {
|
||||
let mut proxy_overides = ProxyOverides {
|
||||
proxy_url: match &server_config.proxy_url {
|
||||
Some(url) => Some(url.to_string()),
|
||||
None => None,
|
||||
@@ -102,7 +102,7 @@ async fn main() -> Result<()> {
|
||||
let cert = cert_params.self_signed(&key_pair)?;
|
||||
|
||||
let hash = hmac_sha256::Hash::hash(cert.der().as_ref());
|
||||
client_config.cert_hash = Some(hash.into());
|
||||
proxy_overides.cert_hash = Some(hash.into());
|
||||
|
||||
(cert.pem().into(), key_pair.serialize_pem().into())
|
||||
}
|
||||
@@ -123,13 +123,13 @@ async fn main() -> Result<()> {
|
||||
let rustls_config = RustlsConfig::new(Keycert::new().cert(cert.as_slice()).key(key.as_slice()));
|
||||
|
||||
info!(
|
||||
"client config:\n{}",
|
||||
toml::to_string_pretty(&client_config)?
|
||||
"proxy overides:\n{}",
|
||||
toml::to_string_pretty(&proxy_overides)?
|
||||
);
|
||||
|
||||
let config_craft = ConfigCraft {
|
||||
server_config: server_config.clone(),
|
||||
client_config,
|
||||
proxy_overides,
|
||||
};
|
||||
|
||||
let status_craft = StatusCraft {
|
||||
@@ -252,14 +252,14 @@ impl StatusCraft {
|
||||
#[derive(Clone)]
|
||||
pub struct ConfigCraft {
|
||||
server_config: Arc<Config>,
|
||||
client_config: ProxyOverides,
|
||||
proxy_overides: ProxyOverides,
|
||||
}
|
||||
|
||||
#[craft]
|
||||
impl ConfigCraft {
|
||||
#[craft(handler)]
|
||||
async fn get_config(&self) -> Json<ProxyOverides> {
|
||||
Json(self.client_config.clone())
|
||||
Json(self.proxy_overides.clone())
|
||||
}
|
||||
|
||||
#[craft(handler)]
|
||||
|
||||
Reference in New Issue
Block a user