|
|
@@ -310,7 +310,9 @@ where
|
|
|
F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
|
{
|
|
|
- emit_status("Preparing to install Node.js...", 0.0, Some("install.preparing"), false, None);
|
|
|
+ emit_status("正在准备安装 Node.js...", 0.0, Some("install.preparing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Node.js"
|
|
|
+ })));
|
|
|
|
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
|
@@ -324,7 +326,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
|
- emit_status("Downloading Node.js...", 10.0, Some("install.downloadingStart"), false, None);
|
|
|
+ emit_status("正在下载 Node.js...", 10.0, Some("install.downloadingStart"), false, Some(serde_json::json!({
|
|
|
+ "software": "Node.js"
|
|
|
+ })));
|
|
|
|
|
|
// 获取镜像配置
|
|
|
let mirror_config = get_nodejs_mirror_config().await;
|
|
|
@@ -363,8 +367,9 @@ where
|
|
|
if should_log {
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
|
- let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
+ let message = format!("正在下载 Node.js... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
+ "software": "Node.js",
|
|
|
"percent": format!("{:.0}", percent),
|
|
|
"downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
"total": format!("{:.1}MB", total_mb)
|
|
|
@@ -380,7 +385,9 @@ where
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- emit_status("安装中...", 55.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Node.js...", 55.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Node.js"
|
|
|
+ })));
|
|
|
|
|
|
// 执行安装
|
|
|
let mut args = vec!["/i", msi_path.to_str().unwrap(), "/qn"];
|
|
|
@@ -411,7 +418,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
|
- emit_status("Installing Node.js via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Node.js...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Node.js"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
|
@@ -433,7 +442,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
|
- emit_status("Installing Node.js...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Node.js...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Node.js"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 NodeSource 安装
|
|
|
let major_version = version.trim_start_matches('v').split('.').next().unwrap_or("22");
|
|
|
@@ -474,7 +485,9 @@ where
|
|
|
F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
|
{
|
|
|
- emit_status("安装中...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 pnpm...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "pnpm"
|
|
|
+ })));
|
|
|
|
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
|
@@ -512,7 +525,9 @@ where
|
|
|
F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
|
{
|
|
|
- emit_status("正在准备安装...", 0.0, Some("install.preparing"), false, None);
|
|
|
+ emit_status("正在准备安装 VS Code...", 0.0, Some("install.preparing"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
|
@@ -524,7 +539,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloadingStart"), false, None);
|
|
|
+ emit_status("正在下载 VS Code...", 10.0, Some("install.downloadingStart"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
// 获取镜像配置
|
|
|
let mirror_config = get_vscode_mirror_config().await;
|
|
|
@@ -580,15 +597,18 @@ where
|
|
|
if should_log {
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
|
- let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
+ let message = format!("正在下载 VS Code... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
+ "software": "VS Code",
|
|
|
"percent": format!("{:.0}", percent),
|
|
|
"downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
"total": format!("{:.1}MB", total_mb)
|
|
|
})));
|
|
|
}).await?;
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 VS Code...", 65.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART", "/MERGETASKS=!runcode"];
|
|
|
|
|
|
@@ -616,7 +636,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
|
- emit_status("Installing VS Code via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 VS Code...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install --cask visual-studio-code")
|
|
|
@@ -636,7 +658,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloadingStart"), false, None);
|
|
|
+ emit_status("正在下载 VS Code...", 10.0, Some("install.downloadingStart"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
// 下载并安装 .deb 包
|
|
|
let download_url = "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
|
|
|
@@ -656,15 +680,18 @@ where
|
|
|
if should_log {
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
|
- let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
+ let message = format!("正在下载 VS Code... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
+ "software": "VS Code",
|
|
|
"percent": format!("{:.0}", percent),
|
|
|
"downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
"total": format!("{:.1}MB", total_mb)
|
|
|
})));
|
|
|
}).await?;
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 VS Code...", 65.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "VS Code"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let cmd = format!("sudo dpkg -i {}", deb_path.to_str().unwrap());
|
|
|
@@ -698,7 +725,9 @@ where
|
|
|
F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
|
{
|
|
|
- emit_status("正在准备安装...", 0.0, Some("install.preparing"), false, None);
|
|
|
+ emit_status("正在准备安装 Git...", 0.0, Some("install.preparing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Git"
|
|
|
+ })));
|
|
|
|
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|
|
|
@@ -710,7 +739,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
|
- emit_status("正在下载...", 10.0, Some("install.downloadingStart"), false, None);
|
|
|
+ emit_status("正在下载 Git...", 10.0, Some("install.downloadingStart"), false, Some(serde_json::json!({
|
|
|
+ "software": "Git"
|
|
|
+ })));
|
|
|
|
|
|
// 获取镜像配置
|
|
|
let mirror_config = get_git_mirror_config().await;
|
|
|
@@ -794,15 +825,18 @@ where
|
|
|
if should_log {
|
|
|
last_logged_percent = (current_percent / 10) * 10;
|
|
|
}
|
|
|
- let message = format!("下载中... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
+ let message = format!("正在下载 Git... {:.0}% ({:.1}MB / {:.1}MB)", percent, downloaded_mb, total_mb);
|
|
|
emit_status(&message, progress, Some("install.downloading"), !should_log, Some(serde_json::json!({
|
|
|
+ "software": "Git",
|
|
|
"percent": format!("{:.0}", percent),
|
|
|
"downloaded": format!("{:.1}MB", downloaded_mb),
|
|
|
"total": format!("{:.1}MB", total_mb)
|
|
|
})));
|
|
|
}).await?;
|
|
|
|
|
|
- emit_status("安装中...", 65.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Git...", 65.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Git"
|
|
|
+ })));
|
|
|
|
|
|
let mut args = vec!["/VERYSILENT", "/NORESTART"];
|
|
|
|
|
|
@@ -830,7 +864,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
{
|
|
|
- emit_status("Installing Git via Homebrew...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Git...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Git"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH(包括 Homebrew 路径)
|
|
|
let output = run_shell_hidden("brew install git")
|
|
|
@@ -850,7 +886,9 @@ where
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
|
- emit_status("Installing Git...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Git...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Git"
|
|
|
+ })));
|
|
|
|
|
|
// 使用 shell 执行以获取最新的 PATH
|
|
|
let output = run_shell_hidden("sudo apt-get install -y git")
|
|
|
@@ -880,7 +918,9 @@ where
|
|
|
F: Fn(&str, f64, Option<&str>, bool, Option<serde_json::Value>),
|
|
|
C: Fn() -> bool,
|
|
|
{
|
|
|
- emit_status("安装中...", 10.0, Some("install.installing"), false, None);
|
|
|
+ emit_status("正在安装 Claude Code...", 10.0, Some("install.installing"), false, Some(serde_json::json!({
|
|
|
+ "software": "Claude Code"
|
|
|
+ })));
|
|
|
|
|
|
if is_cancelled() {
|
|
|
return Ok(InstallResult {
|