mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
feat: manage clash config
This commit is contained in:
@@ -41,14 +41,11 @@ fn main() -> std::io::Result<()> {
|
||||
}
|
||||
"restart_clash" => {
|
||||
let clash_state = app_handle.state::<states::ClashState>();
|
||||
let profiles_state = app_handle.state::<states::ProfilesState>();
|
||||
let mut clash = clash_state.0.lock().unwrap();
|
||||
match clash.restart_sidecar() {
|
||||
let mut profiles = profiles_state.0.lock().unwrap();
|
||||
match clash.restart_sidecar(&mut profiles) {
|
||||
Ok(_) => {
|
||||
let profiles = app_handle.state::<states::ProfilesState>();
|
||||
let profiles = profiles.0.lock().unwrap();
|
||||
if let Err(err) = profiles.activate(clash.info.clone()) {
|
||||
log::error!("{}", err);
|
||||
}
|
||||
let window = app_handle.get_window("main").unwrap();
|
||||
window.emit("restart_clash", "yes").unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user