feat(client): protocol v2 wire layer, screen sharing, channel webhooks and secure voice

Verified against the real gateway via tests/gateway_interop.rs.
This commit is contained in:
Loki 2026-10-24 16:51:15 +02:00
parent 8460fb28fd
commit 3d7dd5413b
Signed by: boba
GPG key ID: 253067914055423B
65 changed files with 6048 additions and 1156 deletions

View file

@ -19,6 +19,8 @@ use vnox_client::net::NetHandle;
use crate::ui::state::{ConnState, UiState};
pub struct AppState {
pub(crate) webhooks: Option<Rc<ui::webhooks::WebhookUi>>,
pub(crate) connection_generation: u64,
pub(crate) identity: identity::Identity,
pub(crate) net: NetHandle,
pub(crate) ui: UiState,
@ -46,6 +48,8 @@ fn main() -> Result<()> {
let net = net::spawn(identity.clone());
let state = Rc::new(RefCell::new(AppState {
webhooks: None,
connection_generation: 0,
identity,
net,
ui: UiState::default(),
@ -67,8 +71,17 @@ fn main() -> Result<()> {
window.set_address_input(state.borrow().ui.connect_input.as_str().into());
refresh_devices(&window);
let webhook_net = state.borrow().net.clone();
state.borrow_mut().webhooks = Some(Rc::new(ui::webhooks::WebhookUi::new(Rc::new(
move |command| {
let net = webhook_net.clone();
tokio::spawn(async move {
net.send(command).await;
});
},
))?));
wire_signals(&window, &state);
ui::media::wire(&window)?;
ui::media::wire(&window, &state)?;
let timer = slint::Timer::default();
{
@ -150,6 +163,34 @@ fn refresh_devices(window: &MainWindow) {
}
fn wire_signals(window: &MainWindow, state: &Rc<RefCell<AppState>>) {
{
let state = state.clone();
let weak = window.as_weak();
window.on_open_webhooks(move || {
let s = state.borrow();
let Some(window) = weak.upgrade() else { return };
if let Some(webhooks) = &s.webhooks {
let channel =
s.ui.active_channel
.as_deref()
.and_then(|id| s.ui.channels.iter().find(|c| c.id == id));
let scope = vnox_client::webhooks::Scope {
connection: s.connection_generation,
channel_id: channel.map(|c| c.id.clone()).unwrap_or_default(),
channel_name: channel.map(|c| c.name.clone()).unwrap_or_default(),
guild_id: channel.and_then(|c| c.guild_id.clone()).unwrap_or_default(),
};
if let Err(error) = webhooks.open(
&window,
scope,
matches!(s.ui.conn, ConnState::Connected { .. }),
) {
tracing::warn!(%error,"Cannot open webhooks");
}
}
});
}
crate::ui::appearance::wire(window, state, !cfg!(test));
ui::i18n::wire(window, !cfg!(test));
crate::ui::avatar::wire(window, state, !cfg!(test));