Phase 2: E2EE for DM + Slint migration + dead code cleanup
- E2EE crypto (src/e2ee.rs) with X25519 key derivation from Ed25519, HKDF shared secret, ChaCha20-Poly1305 encrypt/decrypt - E2EE net layer: PID 0x0071-0x0074, JSON payloads, dispatch, session handlers - E2EE UI: lock icons in DM header and sidebar - Slint migration: all .slint files, bridge.rs, update.rs, main.rs - Removed egui UI (~50 files), cleaned all dead code - Clean cargo clippy -- -D warnings
This commit is contained in:
parent
f361b037cb
commit
03d94e0465
83 changed files with 5055 additions and 9202 deletions
|
|
@ -2,57 +2,12 @@ mod default;
|
|||
mod models;
|
||||
mod types;
|
||||
|
||||
pub use models::{
|
||||
Channel, ChatMessage, DmConversation, FriendState, GuildState, NodeBookmark, SettingsPage,
|
||||
};
|
||||
pub use types::{ConnState, TYPING_TIMEOUT, UiState, VoiceUiState};
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
pub use models::{Channel, ChatMessage, DmConversation, FriendState, GuildState, NodeBookmark};
|
||||
pub use types::{ConnState, UiState, VoiceUiState};
|
||||
|
||||
use models::bookmark_label_from_address;
|
||||
|
||||
impl UiState {
|
||||
pub fn refresh_audio_devices(&mut self) {
|
||||
let now = Instant::now();
|
||||
if let Some(last) = self.last_device_scan
|
||||
&& now.duration_since(last) < Duration::from_millis(2500)
|
||||
{
|
||||
return;
|
||||
}
|
||||
self.last_device_scan = Some(now);
|
||||
|
||||
match vnox_client::audio::devices::enumerate() {
|
||||
Ok(lists) => {
|
||||
self.input_device_labels = lists.input_labels;
|
||||
self.input_device_metas = lists.input_devices;
|
||||
self.output_device_labels = lists.output_labels;
|
||||
self.output_device_metas = lists.output_devices;
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("audio device enumeration: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
if self.input_device_labels.is_empty() {
|
||||
self.input_device_labels.push("Default".into());
|
||||
}
|
||||
if self.output_device_labels.is_empty() {
|
||||
self.output_device_labels.push("Default".into());
|
||||
}
|
||||
|
||||
self.mic_device = self
|
||||
.mic_device
|
||||
.min(self.input_device_labels.len().saturating_sub(1));
|
||||
self.output_device = self
|
||||
.output_device
|
||||
.min(self.output_device_labels.len().saturating_sub(1));
|
||||
}
|
||||
|
||||
pub fn force_refresh_audio_devices(&mut self) {
|
||||
self.last_device_scan = None;
|
||||
self.refresh_audio_devices();
|
||||
}
|
||||
|
||||
pub fn remove_bookmark(&mut self, index: usize) {
|
||||
if index < self.bookmarks.len() {
|
||||
self.bookmarks.remove(index);
|
||||
|
|
@ -73,11 +28,6 @@ impl UiState {
|
|||
true
|
||||
}
|
||||
|
||||
pub fn voice_elapsed(&self) -> Option<String> {
|
||||
let secs = self.voice_joined_at?.elapsed().as_secs();
|
||||
Some(format!("{}:{:02}", secs / 60, secs % 60))
|
||||
}
|
||||
|
||||
pub fn nick_for<'a>(&'a self, sender_id: &'a str) -> &'a str {
|
||||
self.user_names
|
||||
.get(sender_id)
|
||||
|
|
@ -85,12 +35,6 @@ impl UiState {
|
|||
.unwrap_or(sender_id)
|
||||
}
|
||||
|
||||
pub fn active_voice_channel(&self) -> Option<&Channel> {
|
||||
self.channels
|
||||
.iter()
|
||||
.find(|c| matches!(&self.voice, VoiceUiState::Active { channel } if channel == &c.id))
|
||||
}
|
||||
|
||||
pub fn seed_default_channels(&mut self) {
|
||||
if !self.channels.is_empty() {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue