feat: show service mode installation prompts in user mode

This commit is contained in:
wonfen
2025-03-03 14:42:31 +08:00
parent a18efb0e71
commit 07bdc108ed
9 changed files with 161 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
use super::CmdResult;
use crate::{core::handle, model::sysinfo::PlatformSpecification};
use tauri_plugin_clipboard_manager::ClipboardExt;
use crate::{core::{self, CoreManager, service}, wrap_err};
#[tauri::command]
pub async fn export_diagnostic_info() -> CmdResult<()> {
@@ -15,3 +16,19 @@ pub async fn export_diagnostic_info() -> CmdResult<()> {
}
Ok(())
}
/// 获取当前内核运行模式
#[tauri::command]
pub async fn get_running_mode() -> Result<String, String> {
match CoreManager::global().get_running_mode().await {
core::RunningMode::Service => Ok("service".to_string()),
core::RunningMode::Sidecar => Ok("sidecar".to_string()),
core::RunningMode::NotRunning => Ok("not_running".to_string()),
}
}
/// 安装/重装系统服务
#[tauri::command]
pub async fn install_service() -> CmdResult {
wrap_err!(service::reinstall_service().await)
}