|
@@ -197,13 +197,14 @@ pub async fn install_software(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 发送安装状态事件
|
|
// 发送安装状态事件
|
|
|
- let emit_status = |message: &str, progress: f64, i18n_key: Option<&str>, skip_log: bool| {
|
|
|
|
|
|
|
+ let emit_status = |message: &str, progress: f64, i18n_key: Option<&str>, skip_log: bool, i18n_params: Option<serde_json::Value>| {
|
|
|
let _ = app.emit("install-status", serde_json::json!({
|
|
let _ = app.emit("install-status", serde_json::json!({
|
|
|
"software": software,
|
|
"software": software,
|
|
|
"message": message,
|
|
"message": message,
|
|
|
"progress": progress,
|
|
"progress": progress,
|
|
|
"i18nKey": i18n_key,
|
|
"i18nKey": i18n_key,
|
|
|
"skipLog": skip_log,
|
|
"skipLog": skip_log,
|
|
|
|
|
+ "i18nParams": i18n_params,
|
|
|
}));
|
|
}));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -305,10 +306,10 @@ async fn install_nodejs<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("Preparing to install Node.js...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
+ emit_status("Preparing to install Node.js...", 0.0, Some("install.preparing"), false, None);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -322,7 +323,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Downloading Node.js...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
+ emit_status("Downloading Node.js...", 10.0, Some("install.downloading"), false, None);
|
|
|
|
|
|
|
|
// 构建下载 URL
|
|
// 构建下载 URL
|
|
|
let download_url = format!(
|
|
let download_url = format!(
|
|
@@ -349,7 +350,11 @@ where
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
- emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
|
|
+ "percent": format!("{:.0}", percent),
|
|
|
|
|
+ "downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
|
|
+ "total": format!("{:.1}MB", total_mb)
|
|
|
|
|
+ })));
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
@@ -361,7 +366,7 @@ where
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- emit_status("安装中...", 55.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 55.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 执行安装
|
|
// 执行安装
|
|
|
let mut args = vec!["/i", msi_path.to_str().unwrap(), "/qn"];
|
|
let mut args = vec!["/i", msi_path.to_str().unwrap(), "/qn"];
|
|
@@ -379,7 +384,7 @@ where
|
|
|
let _ = std::fs::remove_file(&msi_path);
|
|
let _ = std::fs::remove_file(&msi_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -392,7 +397,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Node.js via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("Installing Node.js via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
@@ -401,7 +406,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -414,7 +419,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Node.js...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("Installing Node.js...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 NodeSource 安装
|
|
// 使用 NodeSource 安装
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
@@ -432,7 +437,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if install_output.status.success() {
|
|
if install_output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Node.js installed successfully".to_string(),
|
|
message: "Node.js installed successfully".to_string(),
|
|
@@ -452,10 +457,10 @@ async fn install_pnpm<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("安装中...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -470,7 +475,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "pnpm installed successfully".to_string(),
|
|
message: "pnpm installed successfully".to_string(),
|
|
@@ -490,10 +495,10 @@ async fn install_vscode<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("正在准备安装...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
+ emit_status("正在准备安装...", 0.0, Some("install.preparing"), false, None);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -505,7 +510,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false, None);
|
|
|
|
|
|
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64";
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64";
|
|
|
|
|
|
|
@@ -527,10 +532,14 @@ where
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
- emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
|
|
+ "percent": format!("{:.0}", percent),
|
|
|
|
|
+ "downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
|
|
+ "total": format!("{:.1}MB", total_mb)
|
|
|
|
|
+ })));
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART", "/MERGETASKS=!runcode"];
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART", "/MERGETASKS=!runcode"];
|
|
|
|
|
|
|
@@ -545,7 +554,7 @@ where
|
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -558,14 +567,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing VS Code via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("Installing VS Code via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install --cask visual-studio-code")
|
|
let output = run_shell_hidden("brew install --cask visual-studio-code")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -578,7 +587,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false, None);
|
|
|
|
|
|
|
|
// 下载并安装 .deb 包
|
|
// 下载并安装 .deb 包
|
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
|
|
@@ -599,10 +608,14 @@ where
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
- emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
|
|
+ "percent": format!("{:.0}", percent),
|
|
|
|
|
+ "downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
|
|
+ "total": format!("{:.1}MB", total_mb)
|
|
|
|
|
+ })));
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let cmd = format!("sudo dpkg -i {}", deb_path.to_str().unwrap());
|
|
let cmd = format!("sudo dpkg -i {}", deb_path.to_str().unwrap());
|
|
@@ -612,7 +625,7 @@ where
|
|
|
let _ = std::fs::remove_file(&deb_path);
|
|
let _ = std::fs::remove_file(&deb_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "VS Code installed successfully".to_string(),
|
|
message: "VS Code installed successfully".to_string(),
|
|
@@ -633,10 +646,10 @@ async fn install_git<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("正在准备安装...", 0.0, Some("install.preparing"), false);
|
|
|
|
|
|
|
+ emit_status("正在准备安装...", 0.0, Some("install.preparing"), false, None);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -648,7 +661,7 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloading"), false);
|
|
|
|
|
|
|
+ emit_status("正在下载...", 10.0, Some("install.downloading"), false, None);
|
|
|
|
|
|
|
|
// 获取最新版本
|
|
// 获取最新版本
|
|
|
let client = reqwest::Client::new();
|
|
let client = reqwest::Client::new();
|
|
@@ -693,10 +706,14 @@ where
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
}
|
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
- emit_status(&message, progress, Some("install.downloading"), !should_log);
|
|
|
|
|
|
|
+ emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
|
|
+ "percent": format!("{:.0}", percent),
|
|
|
|
|
+ "downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
|
|
+ "total": format!("{:.1}MB", total_mb)
|
|
|
|
|
+ })));
|
|
|
}).await?;
|
|
}).await?;
|
|
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART"];
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART"];
|
|
|
|
|
|
|
@@ -711,7 +728,7 @@ where
|
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
let _ = std::fs::remove_file(&exe_path);
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -724,14 +741,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Git via Homebrew...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("Installing Git via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install git")
|
|
let output = run_shell_hidden("brew install git")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -744,14 +761,14 @@ where
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
{
|
|
|
- emit_status("Installing Git...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("Installing Git...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let output = run_shell_hidden("sudo apt-get install -y git")
|
|
let output = run_shell_hidden("sudo apt-get install -y git")
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Git installed successfully".to_string(),
|
|
message: "Git installed successfully".to_string(),
|
|
@@ -771,10 +788,10 @@ async fn install_claude_code_software<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool),
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
C: Fn() -> bool,
|
|
|
{
|
|
{
|
|
|
- emit_status("安装中...", 10.0, Some("install.installing"), false);
|
|
|
|
|
|
|
+ emit_status("安装中...", 10.0, Some("install.installing"), false, None);
|
|
|
|
|
|
|
|
if is_cancelled() {
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
return Ok(InstallResult {
|
|
@@ -789,7 +806,7 @@ where
|
|
|
.map_err(|e| e.to_string())?;
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
|
|
|
if output.status.success() {
|
|
if output.status.success() {
|
|
|
- emit_status("安装成功", 100.0, Some("install.success"), false);
|
|
|
|
|
|
|
+ emit_status("安装成功", 100.0, Some("install.success"), false, None);
|
|
|
Ok(InstallResult {
|
|
Ok(InstallResult {
|
|
|
success: true,
|
|
success: true,
|
|
|
message: "Claude Code installed successfully".to_string(),
|
|
message: "Claude Code installed successfully".to_string(),
|
|
@@ -809,7 +826,7 @@ async fn install_all<F, C>(
|
|
|
is_cancelled: C,
|
|
is_cancelled: C,
|
|
|
) -> Result<InstallResult, String>
|
|
) -> Result<InstallResult, String>
|
|
|
where
|
|
where
|
|
|
- F: Fn(&str, f64, Option<&str>, bool) + Copy,
|
|
|
|
|
|
|
+ F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>) + Copy,
|
|
|
C: Fn() -> bool + Copy,
|
|
C: Fn() -> bool + Copy,
|
|
|
{
|
|
{
|
|
|
let mut results = Vec::new();
|
|
let mut results = Vec::new();
|