Compare commits

..

3 Commits

Author SHA1 Message Date
spinline
50b83ebacf chore(ui): remove debugging logs for sse connection
All checks were successful
Build MIPS Binary / build (push) Successful in 1m56s
2026-02-21 00:44:50 +03:00
spinline
566308d889 feat(backend): require rTorrent to be running for backend to start
All checks were successful
Build MIPS Binary / build (push) Successful in 1m54s
2026-02-21 00:42:42 +03:00
spinline
e878d1fe33 chore(ui): add debug logs for SSE connection lifecycle
All checks were successful
Build MIPS Binary / build (push) Successful in 1m56s
2026-02-21 00:29:27 +03:00
2 changed files with 29 additions and 33 deletions

View File

@@ -243,12 +243,14 @@ async fn main() {
let socket_path = std::path::Path::new(&args.socket); let socket_path = std::path::Path::new(&args.socket);
if !socket_path.exists() { if !socket_path.exists() {
tracing::error!("CRITICAL: rTorrent socket not found at {:?}.", socket_path); tracing::error!("CRITICAL: rTorrent socket not found at {:?}.", socket_path);
tracing::warn!( tracing::error!(
"HINT: Make sure rTorrent is running and the SCGI socket is enabled in .rtorrent.rc" "HINT: Make sure rTorrent is running and the SCGI socket is enabled in .rtorrent.rc"
); );
tracing::warn!( tracing::error!(
"HINT: You can configure the socket path via --socket ARG or RTORRENT_SOCKET ENV." "HINT: You can configure the socket path via --socket ARG or RTORRENT_SOCKET ENV."
); );
tracing::error!("FATAL: VibeTorrent cannot start without a running rTorrent instance. Exiting.");
std::process::exit(1);
} else { } else {
tracing::info!("Socket file exists. Testing connection..."); tracing::info!("Socket file exists. Testing connection...");
let client = xmlrpc::RtorrentClient::new(&args.socket); let client = xmlrpc::RtorrentClient::new(&args.socket);
@@ -259,7 +261,11 @@ async fn main() {
let version = xmlrpc::parse_string_response(&xml).unwrap_or(xml); let version = xmlrpc::parse_string_response(&xml).unwrap_or(xml);
tracing::info!("Connected to rTorrent successfully. Version: {}", version); tracing::info!("Connected to rTorrent successfully. Version: {}", version);
} }
Err(e) => tracing::error!("Socket exists but failed to connect to rTorrent: {}", e), Err(e) => {
tracing::error!("CRITICAL: Socket exists but failed to connect to rTorrent: {}", e);
tracing::error!("FATAL: Ensure rTorrent is fully started and the socket has correct permissions. Exiting.");
std::process::exit(1);
}
} }
} }

View File

@@ -105,39 +105,29 @@ pub fn provide_torrent_store() {
} }
if let Some(data_str) = msg.data().as_string() { if let Some(data_str) = msg.data().as_string() {
match BASE64.decode(&data_str) { if let Ok(bytes) = BASE64.decode(&data_str) {
Ok(bytes) => { if let Ok(event) = rmp_serde::from_slice::<AppEvent>(&bytes) {
match rmp_serde::from_slice::<AppEvent>(&bytes) { match event {
Ok(event) => { AppEvent::FullList(list, _) => {
match event { torrents_for_sse.update(|map| {
AppEvent::FullList(list, _) => { let new_hashes: std::collections::HashSet<String> = list.iter().map(|t| t.hash.clone()).collect();
torrents_for_sse.update(|map| { map.retain(|hash, _| new_hashes.contains(hash));
let new_hashes: std::collections::HashSet<String> = list.iter().map(|t| t.hash.clone()).collect(); for new_torrent in list { map.insert(new_torrent.hash.clone(), new_torrent); }
map.retain(|hash, _| new_hashes.contains(hash)); });
for new_torrent in list { map.insert(new_torrent.hash.clone(), new_torrent); } }
}); AppEvent::Update(patch) => {
} if let Some(hash) = patch.hash.clone() {
AppEvent::Update(patch) => { torrents_for_sse.update(|map| { if let Some(t) = map.get_mut(&hash) { t.apply(patch); } });
if let Some(hash) = patch.hash.clone() { }
torrents_for_sse.update(|map| { if let Some(t) = map.get_mut(&hash) { t.apply(patch); } }); }
} AppEvent::Stats(stats) => { global_stats_for_sse.set(stats); }
} AppEvent::Notification(n) => {
AppEvent::Stats(stats) => { global_stats_for_sse.set(stats); } show_toast(n.level.clone(), n.message.clone());
AppEvent::Notification(n) => { if n.message.contains("tamamlandı") || n.level == shared::NotificationLevel::Error {
show_toast(n.level.clone(), n.message.clone()); show_browser_notification("VibeTorrent", &n.message);
if n.message.contains("tamamlandı") || n.level == shared::NotificationLevel::Error {
show_browser_notification("VibeTorrent", &n.message);
}
}
} }
},
Err(e) => {
log::error!("[SSE] Failed to deserialize AppEvent: {:?}", e);
} }
} }
},
Err(e) => {
log::error!("[SSE] Failed to decode base64: {:?}", e);
} }
} }
} }