Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix: update update_settings and reset_settings to handle autostart configuration

Tonho00ab03c5cfa3
diff --git a/src-tauri/src/commands/settings.rs b/src-tauri/src/commands/settings.rs
index 1317f0aa..39c74552 100644
--- a/src-tauri/src/commands/settings.rs
+++ b/src-tauri/src/commands/settings.rs
@@ -12,6 +12,7 @@ pub fn update_settings(app: tauri::AppHandle, partial: String) -> Result<AppSett
let mut current = config::load_settings(&app);
let old_hotkey_enabled = current.download.hotkey_enabled;
let old_hotkey_binding = current.download.hotkey_binding.clone();
+ let old_start_with_windows = current.start_with_windows;
let patch: serde_json::Value =
serde_json::from_str(&partial).map_err(|e| format!("Invalid JSON: {}", e))?;
@@ -28,6 +29,10 @@ pub fn update_settings(app: tauri::AppHandle, partial: String) -> Result<AppSett
hotkey::reregister(&app);
}
+ if old_start_with_windows != current.start_with_windows {
+ crate::commands::autostart::apply_autostart(current.start_with_windows)?;
+ }
+
Ok(current)
}
@@ -36,6 +41,7 @@ pub fn reset_settings(app: tauri::AppHandle) -> Result<AppSettings, String> {
let defaults = AppSettings::default();
config::save_settings(&app, &defaults).map_err(|e| format!("Save: {}", e))?;
hotkey::reregister(&app);
+ let _ = crate::commands::autostart::apply_autostart(defaults.start_with_windows);
Ok(defaults)
}