fix: app freeze when emit refresh proxy config event (#7662)

This commit is contained in:
oomeow
2026-08-01 15:19:26 +00:00
committed by GitHub
parent 8ef6f0cc23
commit 49257a026c
3 changed files with 7 additions and 2 deletions
+4
View File
@@ -47,6 +47,10 @@ impl Handle {
Self::send_event(FrontendEvent::RefreshProfiles);
}
pub fn refresh_proxy_config() {
Self::send_event(FrontendEvent::RefreshProxyConfig);
}
/// Push a Run State snapshot to the frontend.
///
/// Sent on every transition, so the frontend does not have to poll to notice that the Core
+2
View File
@@ -9,6 +9,7 @@ pub enum FrontendEvent<'a> {
RefreshClash,
RefreshVerge,
RefreshProfiles,
RefreshProxyConfig,
NoticeMessage { status: &'a str, message: String },
ProfileChanged { current_profile_id: &'a String },
TimerUpdated { profile_index: &'a String },
@@ -32,6 +33,7 @@ impl NotificationSystem {
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::RefreshProxyConfig => ("verge://refresh-proxy-config", Ok(serde_json::Value::Null)),
FrontendEvent::NoticeMessage { status, message } => {
("verge://notice-message", serde_json::to_value((status, message)))
}