mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-08-21 14:27:14 +00:00
works with macos native ui
This commit is contained in:
@@ -27,6 +27,9 @@ pub fn run_settings_window() {
|
|||||||
async fn perform_sync(settings: &KhmSettings) -> std::io::Result<()> {
|
async fn perform_sync(settings: &KhmSettings) -> std::io::Result<()> {
|
||||||
use crate::Args;
|
use crate::Args;
|
||||||
|
|
||||||
|
info!("Starting sync with settings: host={}, flow={}, known_hosts={}, in_place={}",
|
||||||
|
settings.host, settings.flow, settings.known_hosts, settings.in_place);
|
||||||
|
|
||||||
// Convert KhmSettings to Args for client module
|
// Convert KhmSettings to Args for client module
|
||||||
let args = Args {
|
let args = Args {
|
||||||
server: false,
|
server: false,
|
||||||
@@ -46,6 +49,8 @@ async fn perform_sync(settings: &KhmSettings) -> std::io::Result<()> {
|
|||||||
basic_auth: settings.basic_auth.clone(),
|
basic_auth: settings.basic_auth.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
info!("Expanded known_hosts path: {}", args.known_hosts);
|
||||||
|
|
||||||
crate::client::run_client(args).await
|
crate::client::run_client(args).await
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,13 +276,25 @@ impl ApplicationHandler<UserEvent> for Application {
|
|||||||
} else if event.id == *sync_id {
|
} else if event.id == *sync_id {
|
||||||
info!("Starting sync operation");
|
info!("Starting sync operation");
|
||||||
let settings = self.settings.lock().unwrap().clone();
|
let settings = self.settings.lock().unwrap().clone();
|
||||||
tokio::spawn(async move {
|
|
||||||
if let Err(e) = perform_sync(&settings).await {
|
// Check if settings are valid
|
||||||
error!("Sync failed: {}", e);
|
if settings.host.is_empty() || settings.flow.is_empty() {
|
||||||
} else {
|
error!("Cannot sync: host or flow not configured");
|
||||||
info!("Sync completed successfully");
|
} else {
|
||||||
}
|
info!("Syncing with host: {}, flow: {}", settings.host, settings.flow);
|
||||||
});
|
|
||||||
|
// Run sync in separate thread with its own tokio runtime
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
|
rt.block_on(async {
|
||||||
|
if let Err(e) = perform_sync(&settings).await {
|
||||||
|
error!("Sync failed: {}", e);
|
||||||
|
} else {
|
||||||
|
info!("Sync completed successfully");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user