further simplify proxy config

This commit is contained in:
2025-10-25 18:15:26 -06:00
parent 134e42e69f
commit b8a201911f
11 changed files with 114 additions and 2693 deletions
+6 -6
View File
@@ -3,7 +3,7 @@
use base64::{display::Base64Display, prelude::BASE64_URL_SAFE};
use dioxus::prelude::*;
use mime_guess::Mime;
use mumble_web2_common::GuiConfig;
use mumble_web2_common::ClientConfig;
use ordermap::OrderSet;
use sir::{css, global_css};
use std::collections::HashMap;
@@ -26,7 +26,7 @@ pub enum Command {
Connect {
address: String,
username: String,
config: GuiConfig,
config: ClientConfig,
},
SendChat {
markdown: String,
@@ -437,7 +437,7 @@ pub fn ChatView() -> Element {
//},
#[component]
pub fn ControlView(config: Resource<GuiConfig>) -> Element {
pub fn ControlView(config: Resource<ClientConfig>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let status = &STATE.status;
let server = STATE.server.read();
@@ -705,7 +705,7 @@ pub fn ControlView(config: Resource<GuiConfig>) -> Element {
}
#[component]
pub fn ServerView(config: Resource<GuiConfig>) -> Element {
pub fn ServerView(config: Resource<ClientConfig>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let server = STATE.server.read();
let Some(&UserState {
@@ -803,7 +803,7 @@ pub fn ServerView(config: Resource<GuiConfig>) -> Element {
}
#[component]
pub fn LoginView(config: Resource<GuiConfig>) -> Element {
pub fn LoginView(config: Resource<ClientConfig>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let mut address_input = use_signal(|| None::<String>);
@@ -931,7 +931,7 @@ pub fn app() -> Element {
let config = use_resource(|| async move {
match imp::load_config().await {
Ok(config) => config,
Err(_) => GuiConfig::default(),
Err(_) => ClientConfig::default(),
}
});
+3 -3
View File
@@ -5,7 +5,7 @@ use dioxus::hooks::{UnboundedReceiver, UnboundedSender};
use futures::io::{AsyncRead, AsyncWrite};
use mumble_protocol::control::{ClientControlCodec, ControlPacket};
use mumble_protocol::Serverbound;
use mumble_web2_common::GuiConfig;
use mumble_web2_common::ClientConfig;
use std::net::ToSocketAddrs;
use std::sync::Mutex;
use std::{fmt, io, sync::Arc};
@@ -188,7 +188,7 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &GuiConfig,
gui_config: &ClientConfig,
) -> Result<(), Error> {
info!("connecting");
@@ -228,7 +228,7 @@ pub fn load_username() -> Option<String> {
return None;
}
pub async fn load_config() -> color_eyre::Result<GuiConfig> {
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
color_eyre::eyre::bail!(
"there is no config on desktop because desktops cannot be configured as they are tables"
)
+12 -7
View File
@@ -7,7 +7,7 @@ use gloo_timers::future::TimeoutFuture;
use mumble_protocol::control::{ClientControlCodec, ControlPacket};
use mumble_protocol::voice::{VoicePacket, VoicePacketPayload};
use mumble_protocol::Serverbound;
use mumble_web2_common::GuiConfig;
use mumble_web2_common::ClientConfig;
use reqwest::Url;
use std::time::Duration;
use tracing::level_filters::LevelFilter;
@@ -178,8 +178,8 @@ impl AudioPlayer {
// Borrowed from
// https://github.com/security-union/videocall-rs/blob/main/videocall-client/src/decode/config.rs#L6
fn configure_audio_context() -> AudioContext {
let mut audio_context_options = AudioContextOptions::new();
audio_context_options.sample_rate(48000 as f32);
let audio_context_options = AudioContextOptions::new();
audio_context_options.set_sample_rate(48000 as f32);
let audio_context = AudioContext::new_with_context_options(&audio_context_options).unwrap();
audio_context
}
@@ -198,12 +198,14 @@ async fn run_encoder_worklet(
audio_context: &AudioContext,
mut each: impl FnMut(Vec<u8>) + 'static,
) -> Result<AudioWorkletNode, Error> {
let constraints = MediaStreamConstraints::new();
constraints.set_audio(&JsValue::TRUE);
let stream = window()
.unwrap()
.navigator()
.media_devices()
.ey()?
.get_user_media_with_constraints(MediaStreamConstraints::new().audio(&JsValue::TRUE))
.get_user_media_with_constraints(&constraints)
.ey()?
.into_future()
.await
@@ -309,7 +311,7 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &GuiConfig,
gui_config: &ClientConfig,
) -> Result<(), Error> {
info!("connecting");
@@ -388,7 +390,7 @@ pub fn load_username() -> Option<String> {
.ok()?
}
pub async fn load_config() -> color_eyre::Result<GuiConfig> {
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
let config_url = match option_env!("MUMBLE_WEB2_GUI_CONFIG_URL") {
Some(url) => Url::parse(url)?,
None => {
@@ -399,7 +401,10 @@ pub async fn load_config() -> color_eyre::Result<GuiConfig> {
};
info!("loading config from {}", config_url);
let config = reqwest::get(config_url).await?.json::<GuiConfig>().await?;
let config = reqwest::get(config_url)
.await?
.json::<ClientConfig>()
.await?;
Ok(config)
}
+1 -1
View File
@@ -20,7 +20,7 @@ use mumble_protocol::voice::VoicePacket;
use mumble_protocol::voice::VoicePacketPayload;
use mumble_protocol::Clientbound;
use mumble_protocol::Serverbound;
use mumble_web2_common::GuiConfig;
use mumble_web2_common::ClientConfig;
use once_cell::sync::Lazy;
use std::collections::hash_map::Entry;
use std::collections::HashMap;