feat: less bad installations

This commit is contained in:
2025-02-23 20:54:47 +01:00
parent caead1e70f
commit 6236b8ef96
13 changed files with 124 additions and 58 deletions

View File

@ -29,24 +29,17 @@ pub async fn startline(state: State<'_, Mutex<AppData>>) -> Result<(), String> {
#[tauri::command]
pub async fn install_package(state: State<'_, tokio::sync::Mutex<AppData>>, key: PkgKey) -> Result<InstallResult, String> {
log::debug!("invoke: install_package");
log::debug!("invoke: install_package({})", key);
let mut appd = state.lock().await;
let rv = appd.pkgs.install_package(&key, true)
appd.pkgs.install_package(&key, true, true)
.await
.map_err(|e| e.to_string());
// if rv.is_ok() {
// _ = appd.toggle_package(key, true);
// }
rv
.map_err(|e| e.to_string())
}
#[tauri::command]
pub async fn delete_package(state: State<'_, tokio::sync::Mutex<AppData>>, key: PkgKey) -> Result<(), String> {
log::debug!("invoke: delete_package");
log::debug!("invoke: delete_package({})", key);
let mut appd = state.lock().await;
appd.pkgs.delete_package(&key, true)
@ -56,7 +49,7 @@ pub async fn delete_package(state: State<'_, tokio::sync::Mutex<AppData>>, key:
#[tauri::command]
pub async fn get_package(state: State<'_, tokio::sync::Mutex<AppData>>, key: PkgKey) -> Result<Package, String> {
log::debug!("invoke: get_package");
log::debug!("invoke: get_package({})", key);
let appd = state.lock().await;
appd.pkgs.get(key)
@ -66,7 +59,7 @@ pub async fn get_package(state: State<'_, tokio::sync::Mutex<AppData>>, key: Pkg
#[tauri::command]
pub async fn toggle_package(state: State<'_, tokio::sync::Mutex<AppData>>, key: PkgKey, enable: bool) -> Result<(), String> {
log::debug!("invoke: toggle_package");
log::debug!("invoke: toggle_package({}, {})", key, enable);
let mut appd = state.lock().await;
appd.toggle_package(key, enable)