remove all software
This commit is contained in:
@@ -8,7 +8,7 @@ use std::path::PathBuf;
|
||||
use tokio::sync::mpsc;
|
||||
use tauri::{AppHandle, Manager, State, Emitter};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use winget::{Software, list_all_software, list_updates, ensure_winget_dependencies};
|
||||
use winget::{Software, list_installed_software, list_updates, ensure_winget_dependencies};
|
||||
use regex::Regex;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
@@ -155,8 +155,8 @@ fn get_essentials(app: AppHandle) -> Option<EssentialsRepo> {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn get_all_software(app: AppHandle) -> Vec<Software> {
|
||||
tokio::task::spawn_blocking(move || list_all_software(&app)).await.unwrap_or_default()
|
||||
async fn get_installed_software(app: AppHandle) -> Vec<Software> {
|
||||
tokio::task::spawn_blocking(move || list_installed_software(&app)).await.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -308,7 +308,7 @@ pub fn run() {
|
||||
save_settings,
|
||||
sync_essentials,
|
||||
get_essentials,
|
||||
get_all_software,
|
||||
get_installed_software,
|
||||
get_updates,
|
||||
install_software,
|
||||
get_logs_history
|
||||
|
||||
@@ -104,8 +104,8 @@ pub fn ensure_winget_dependencies(handle: &AppHandle) -> Result<(), String> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_all_software(handle: &AppHandle) -> Vec<Software> {
|
||||
let log_id = format!("list-all-{}", chrono::Local::now().timestamp_millis());
|
||||
pub fn list_installed_software(handle: &AppHandle) -> Vec<Software> {
|
||||
let log_id = format!("list-installed-{}", chrono::Local::now().timestamp_millis());
|
||||
let script = r#"
|
||||
$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
@@ -125,7 +125,7 @@ pub fn list_all_software(handle: &AppHandle) -> Vec<Software> {
|
||||
}
|
||||
"#;
|
||||
|
||||
execute_powershell(handle, &log_id, "Fetch All Software", script)
|
||||
execute_powershell(handle, &log_id, "Fetch Installed Software", script)
|
||||
}
|
||||
|
||||
pub fn list_updates(handle: &AppHandle) -> Vec<Software> {
|
||||
|
||||
Reference in New Issue
Block a user