rename gui_config to proxy_overrides (#23)
Build Mumble Web 2 / linux_build (push) Successful in 1m13s
Build Mumble Web 2 / windows_build (push) Successful in 2m39s
Build Mumble Web 2 / android_build (push) Successful in 6m18s
Build android container / android-release-builder-container-build (push) Successful in -7s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 30m8s

Reviewed-on: #23
Reviewed-by: restitux <restitux@ohea.xyz>
Co-authored-by: Sam Sartor <me@samsartor.com>
Co-committed-by: Sam Sartor <me@samsartor.com>
This commit was merged in pull request #23.
This commit is contained in:
2026-03-05 07:16:02 +00:00
committed by Sam Sartor
parent 9006a082b0
commit 847c636f41
11 changed files with 69 additions and 75 deletions
+18 -18
View File
@@ -2,7 +2,7 @@
use dioxus::prelude::*;
use mime_guess::Mime;
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use ordermap::OrderSet;
use std::collections::{HashMap, HashSet};
@@ -23,7 +23,7 @@ pub enum Command {
Connect {
address: String,
username: String,
config: ClientConfig,
config: ProxyOverrides,
},
SendChat {
markdown: String,
@@ -454,7 +454,7 @@ pub fn ChatView() -> Element {
}
#[component]
pub fn ControlView(config: Resource<ClientConfig>) -> Element {
pub fn ControlView(overrides: Resource<ProxyOverrides>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let status = &STATE.status;
let server = STATE.server.read();
@@ -474,10 +474,10 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
let current_channel_name = server.channels_state.channels[&channel].name.clone();
let proxy_url = config
let proxy_url = overrides
.read_unchecked()
.as_ref()
.and_then(|gui_config| gui_config.proxy_url.clone());
.and_then(|overrides| overrides.proxy_url.clone());
let connecting_color = "yellow";
let connected_color = "oklch(0.55 0.1184 141.35)";
@@ -645,7 +645,7 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
}
#[component]
pub fn ServerView(config: Resource<ClientConfig>) -> Element {
pub fn ServerView(overrides: Resource<ProxyOverrides>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let server = STATE.server.read();
let Some(&UserState {
@@ -676,14 +676,14 @@ pub fn ServerView(config: Resource<ClientConfig>) -> Element {
}
div {
class: "server_control_box",
ControlView { config }
ControlView { overrides }
}
}
)
}
#[component]
pub fn LoginView(config: Resource<ClientConfig>) -> Element {
pub fn LoginView(overrides: Resource<ProxyOverrides>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let last_status = use_signal(|| None::<color_eyre::Result<ServerStatus>>);
@@ -700,7 +700,7 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
if let Some(addr) = address_input() {
addr.clone()
} else {
config()
overrides()
.and_then(|c| c.proxy_url.clone())
.unwrap_or_default()
}
@@ -712,13 +712,13 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
let do_connect = move |_| {
//let _ = set_default_username(&username.read());
let _ = Platform::set_default_username(&username.read());
if config.read().as_ref().is_some_and(|cfg| cfg.any_server) {
if overrides.read().as_ref().is_some_and(|cfg| cfg.any_server) {
Platform::set_default_server(&address.read());
}
net.send(Connect {
address: address.read().clone(),
username: username.read().clone(),
config: config.read().clone().unwrap_or_default(),
config: overrides.read().clone().unwrap_or_default(),
})
};
let status = &STATE.status;
@@ -763,7 +763,7 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
None => rsx!(),
}
}
if config.read().as_ref().is_some_and(|cfg| cfg.any_server) {
if overrides.read().as_ref().is_some_and(|cfg| cfg.any_server) {
div {
label {
for: "address-entry",
@@ -859,10 +859,10 @@ pub fn app() -> Element {
static STYLE: Asset = asset!("/assets/main.scss");
use_coroutine(|rx: UnboundedReceiver<Command>| super::network_entrypoint(rx));
let config = use_resource(|| async move {
match Platform::load_config().await {
Ok(config) => config,
Err(_) => ClientConfig::default(),
let overrides = use_resource(|| async move {
match Platform::load_proxy_overrides().await {
Ok(overrides) => overrides,
Err(_) => ProxyOverrides::default(),
}
});
@@ -874,8 +874,8 @@ pub fn app() -> Element {
document::Link{ rel: "stylesheet", href: STYLE }
match *STATE.status.read() {
Connected => rsx!(ServerView { config }),
_ => rsx!(LoginView { config }),
Connected => rsx!(ServerView { overrides }),
_ => rsx!(LoginView { overrides }),
}
)
}
+4 -4
View File
@@ -8,13 +8,13 @@ use tokio::net::TcpStream;
use tokio_rustls::rustls;
use tokio_rustls::rustls::client::danger::{HandshakeSignatureValid, ServerCertVerifier};
use tokio_rustls::rustls::pki_types::{CertificateDer, ServerName, UnixTime};
use tokio_rustls::rustls::ClientConfig as RlsClientConfig;
use tokio_rustls::rustls::ClientConfig;
use tokio_rustls::rustls::DigitallySignedStruct;
use tokio_rustls::TlsConnector;
use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};
use tracing::{info, instrument};
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
#[derive(Debug)]
struct NoCertificateVerification;
@@ -73,11 +73,11 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
overrides: &ProxyOverrides,
) -> Result<(), Error> {
info!("connecting");
let config = RlsClientConfig::builder()
let config = ClientConfig::builder()
.dangerous()
.with_custom_certificate_verifier(Arc::new(NoCertificateVerification))
.with_no_client_auth();
+5 -5
View File
@@ -2,7 +2,7 @@ use crate::app::Command;
use color_eyre::eyre::Error;
use dioxus::hooks::UnboundedReceiver;
use etcetera::{choose_app_strategy, AppStrategy, AppStrategyArgs};
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use std::collections::HashMap;
use std::time::Duration;
@@ -16,8 +16,8 @@ impl super::PlatformInterface for DesktopPlatform {
tokio::time::sleep(duration).await;
}
async fn load_config() -> color_eyre::Result<ClientConfig> {
Ok(ClientConfig {
async fn load_proxy_overrides() -> color_eyre::Result<ProxyOverrides> {
Ok(ProxyOverrides {
proxy_url: None,
cert_hash: None,
any_server: true,
@@ -50,9 +50,9 @@ impl super::PlatformInterface for DesktopPlatform {
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
overrides: &ProxyOverrides,
) -> Result<(), Error> {
super::connect::network_connect(address, username, event_rx, gui_config).await
super::connect::network_connect(address, username, event_rx, overrides).await
}
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
+5 -6
View File
@@ -1,8 +1,7 @@
use crate::app::Command;
use color_eyre::eyre::Error;
use dioxus::hooks::UnboundedReceiver;
use mumble_web2_common::{ClientConfig, ServerStatus};
use std::future::Future;
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use std::time::Duration;
/// Mobile platform implementation using Tokio, native audio, and Android permissions.
@@ -11,8 +10,8 @@ pub struct MobilePlatform;
impl super::PlatformInterface for MobilePlatform {
type AudioSystem = super::native_audio::NativeAudioSystem;
async fn load_config() -> color_eyre::Result<ClientConfig> {
Ok(ClientConfig {
async fn load_proxy_overrides() -> color_eyre::Result<ProxyOverrides> {
Ok(ProxyOverrides {
proxy_url: None,
cert_hash: None,
any_server: true,
@@ -39,9 +38,9 @@ impl super::PlatformInterface for MobilePlatform {
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
overrides: &ProxyOverrides,
) -> Result<(), Error> {
super::connect::network_connect(address, username, event_rx, gui_config).await
super::connect::network_connect(address, username, event_rx, overrides).await
}
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
+3 -3
View File
@@ -7,7 +7,7 @@
use crate::{app::Command, effects::AudioProcessor};
use color_eyre::eyre::Error;
use dioxus::hooks::UnboundedReceiver;
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use std::future::Future;
use std::time::Duration;
@@ -67,7 +67,7 @@ pub trait PlatformInterface {
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
proxy_overrides: &ProxyOverrides,
) -> impl Future<Output = Result<(), Error>>;
/// Get server status (user count, version, etc.).
@@ -76,7 +76,7 @@ pub trait PlatformInterface {
) -> impl Future<Output = color_eyre::Result<ServerStatus>>;
/// Load the proxy overrides (proxy URL, cert hash, etc.).
fn load_config() -> impl Future<Output = color_eyre::Result<ClientConfig>>;
fn load_proxy_overrides() -> impl Future<Output = color_eyre::Result<ProxyOverrides>>;
/// Load saved username.
fn load_username() -> Option<String>;
+3 -3
View File
@@ -3,7 +3,7 @@
use crate::effects::AudioProcessor;
use color_eyre::eyre::Error;
use dioxus::hooks::UnboundedReceiver;
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use std::future::Future;
pub struct StubPlatform;
@@ -23,7 +23,7 @@ impl super::PlatformInterface for StubPlatform {
_address: String,
_username: String,
_event_rx: &mut UnboundedReceiver<crate::app::Command>,
_gui_config: &ClientConfig,
_overrides: &ProxyOverrides,
) -> impl Future<Output = Result<(), Error>> {
async { panic!("stubbed platform") }
}
@@ -34,7 +34,7 @@ impl super::PlatformInterface for StubPlatform {
async { panic!("stubbed platform") }
}
fn load_config() -> impl Future<Output = color_eyre::Result<ClientConfig>> {
fn load_proxy_overrides() -> impl Future<Output = color_eyre::Result<ProxyOverrides>> {
async { panic!("stubbed platform") }
}
+11 -11
View File
@@ -6,7 +6,7 @@ use dioxus::prelude::*;
use gloo_timers::future::TimeoutFuture;
use js_sys::Float32Array;
use mumble_protocol::control::ClientControlCodec;
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverrides, ServerStatus};
use reqwest::Url;
use std::future::Future;
use std::sync::Arc;
@@ -89,16 +89,16 @@ impl super::PlatformInterface for WebPlatform {
// No-op on web
}
async fn load_config() -> color_eyre::Result<ClientConfig> {
let config_url = match option_env!("MUMBLE_WEB2_GUI_CONFIG_URL") {
async fn load_proxy_overrides() -> color_eyre::Result<ProxyOverrides> {
let overrides = match option_env!("MUMBLE_WEB2_PROXY_OVERRIDES_URL") {
Some(url) => Url::parse(url)?,
None => absolute_url("config")?,
None => absolute_url("overrides")?,
};
info!("loading config from {}", config_url);
info!("loading config from {}", overrides);
let config = reqwest::get(config_url)
let config = reqwest::get(overrides)
.await?
.json::<ClientConfig>()
.json::<ProxyOverrides>()
.await?;
Ok(config)
@@ -133,9 +133,9 @@ impl super::PlatformInterface for WebPlatform {
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
overrides: &ProxyOverrides,
) -> Result<(), Error> {
network_connect(address, username, event_rx, gui_config).await
network_connect(address, username, event_rx, overrides).await
}
async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
@@ -456,7 +456,7 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
overrides: &ProxyOverrides,
) -> Result<(), Error> {
info!("connecting");
@@ -469,7 +469,7 @@ pub async fn network_connect(
)
.ey()?;
if let Some(server_hash) = &gui_config.cert_hash {
if let Some(server_hash) = &overrides.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()?;
}