diff --git a/gui/src/imp/web.rs b/gui/src/imp/web.rs index 79752b2..4c7d08f 100644 --- a/gui/src/imp/web.rs +++ b/gui/src/imp/web.rs @@ -10,7 +10,7 @@ use mumble_protocol::voice::{VoicePacket, VoicePacketPayload}; use mumble_protocol::Serverbound; use mumble_web2_common::GuiConfig; use std::time::Duration; -use tracing::{debug, error, info}; +use tracing::{debug, error, info, instrument}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use web_sys::js_sys::{Promise, Reflect, Uint8Array}; @@ -324,6 +324,7 @@ async fn create_encoder_worklet( Ok(worklet_node) } +#[instrument] pub async fn network_connect( address: String, username: String, @@ -354,6 +355,7 @@ pub async fn network_connect( options.set_server_certificate_hashes(&array); debug!("created WebTransportOptions"); + console::log_1(&options.clone().into()); let transport = WebTransport::new_with_options(&address, &options).ey()?; debug!("created WebTransport connection object"); diff --git a/proxy/config.toml.example b/proxy/config.toml.example index c2d641a..f5f661c 100644 --- a/proxy/config.toml.example +++ b/proxy/config.toml.example @@ -3,9 +3,9 @@ http_listen_address = "127.0.0.1:8080" cert_path = "./cert.pem" key_path = "./key.pem" mumble_server_url = "voip.ohea.xyz:64738" -gui_path = "../target/dx/mumble-web2-gui/debug/web/public" +gui_path = "../target/dx/mumble-web2-gui/release/web/public" [gui] force_proxy = true -proxy_url = "https://localhost:4433/proxy" +proxy_url = "https://127.0.0.1:4433/proxy" # cert_hash = [...] diff --git a/proxy/src/main.rs b/proxy/src/main.rs index 5b0a074..513dc16 100644 --- a/proxy/src/main.rs +++ b/proxy/src/main.rs @@ -8,7 +8,7 @@ use salvo::proto::quic::BidiStream; use serde::Deserialize; use std::net::{SocketAddr, ToSocketAddrs}; use std::path::PathBuf; -use std::sync::Arc; +use std::sync::{Arc, Mutex}; use tokio::fs; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use tokio::net::TcpStream; @@ -24,7 +24,7 @@ use tracing::{error, instrument}; use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::EnvFilter; -#[derive(Clone, Deserialize)] +#[derive(Deserialize)] struct Config { https_listen_address: SocketAddr, http_listen_address: Option, @@ -33,7 +33,7 @@ struct Config { mumble_server_url: String, mumble_server_address: Option, gui_path: PathBuf, - gui: GuiConfig, + gui: Mutex, } static CONFIG: OnceCell = OnceCell::new(); @@ -107,6 +107,11 @@ async fn main() -> Result<()> { .push(Router::with_path("/proxy").goal(connect_proxy)) .push(Router::with_path("/gui").get(serve_gui_index_html)) .push(Router::with_path("/gui/<*+rest>").get(StaticDir::new(config.gui_path.clone()))) + // right now dioxus assets don't properly handle base_url, so we are stuck with this + .push( + Router::with_path("/assets/<*+rest>") + .get(StaticDir::new(config.gui_path.join("assets"))), + ) .hoop(Logger::new()); // Read server certs @@ -193,13 +198,15 @@ async fn connect_proxy(req: &mut Request, res: &mut Response) { */ let (outgoing, incoming) = bi.split(); - tokio::spawn(async move { + let res = tokio::spawn(async move { if let Err(error) = connect_proxy_impl(mumble_server_address, incoming, outgoing).await { error!("error connecting proxy {error:?}") } - }); - - res.render("connected"); + }) + .await; + if let Err(err) = res { + error!("crash in connected proxy {err:?}"); + } } #[instrument(skip(incoming, outgoing))]