feat: reorganize service commands and implement logging for service management

This commit is contained in:
Tunglies
2025-03-26 15:02:08 +08:00
parent 5a0eb56f70
commit 81968a579d
6 changed files with 48 additions and 29 deletions

View File

@@ -0,0 +1,38 @@
use super::CmdResult;
use crate::{
core::{service, CoreManager},
logging_error,
utils::logging::Type,
};
#[tauri::command]
pub async fn install_service() -> CmdResult {
logging_error!(Type::Service, true, service::install_service().await);
logging_error!(Type::Core, true, CoreManager::global().restart_core().await);
Ok(())
}
#[tauri::command]
pub async fn uninstall_service() -> CmdResult {
logging_error!(Type::Service, true, service::uninstall_service().await);
logging_error!(Type::Core, true, CoreManager::global().restart_core().await);
Ok(())
}
#[tauri::command]
pub async fn reinstall_service() -> CmdResult {
logging_error!(Type::Service, true, service::reinstall_service().await);
logging_error!(Type::Core, true, CoreManager::global().restart_core().await);
Ok(())
}
#[tauri::command]
pub async fn repair_service() -> CmdResult {
logging_error!(
Type::Service,
true,
service::force_reinstall_service().await
);
logging_error!(Type::Core, true, CoreManager::global().restart_core().await);
Ok(())
}