fix: safely restore selected proxy nodes

This commit is contained in:
wonfen
2026-07-16 04:16:42 +08:00
parent 6c149d6234
commit cd20bdb6a1
6 changed files with 471 additions and 77 deletions
+4
View File
@@ -44,6 +44,10 @@ impl Handle {
Self::send_event(FrontendEvent::RefreshVerge);
}
pub fn refresh_profiles() {
Self::send_event(FrontendEvent::RefreshProfiles);
}
pub fn notify_profile_changed(profile_id: &String) {
Self::send_event(FrontendEvent::ProfileChanged {
current_profile_id: profile_id,
+2
View File
@@ -9,6 +9,7 @@ use tauri::{Emitter as _, WebviewWindow};
pub enum FrontendEvent<'a> {
RefreshClash,
RefreshVerge,
RefreshProfiles,
NoticeMessage { status: &'a str, message: String },
ProfileChanged { current_profile_id: &'a String },
TimerUpdated { profile_index: &'a String },
@@ -34,6 +35,7 @@ impl NotificationSystem {
match event {
FrontendEvent::RefreshClash => ("verge://refresh-clash-config", Ok(json!("yes"))),
FrontendEvent::RefreshVerge => ("verge://refresh-verge-config", Ok(json!("yes"))),
FrontendEvent::RefreshProfiles => ("verge://refresh-profiles", Ok(json!("yes"))),
FrontendEvent::NoticeMessage { status, message } => {
("verge://notice-message", serde_json::to_value((status, message)))
}