mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-30 21:00:30 +08:00
发布 v0.4.5:修复 nvm 兼容性 + 自动初始化配置
修复: - nvm 用户 Node.js/CLI 检测失败(扫描 nvm 版本目录) - Tauri v2 参数名 snake_case → camelCase 不匹配 - Windows CLI 检测遗漏(增加 PATH 兜底) - Agent/记忆文件页面晦涩 os error 2 → 中文提示 - cargo fmt + clippy 修复 新增: - 初始设置自动创建配置文件 + 一键初始化按钮 - ClawPanel Web 版部署文档 + 文档中心
This commit is contained in:
@@ -514,10 +514,20 @@ pub async fn upgrade_openclaw(app: tauri::AppHandle, source: String) -> Result<S
|
||||
// 自动配置 git 使用 HTTPS 替代 SSH,避免用户没配 SSH Key 导致依赖安装失败
|
||||
let _ = app.emit("upgrade-log", "配置 Git HTTPS 模式...");
|
||||
let _ = Command::new("git")
|
||||
.args(["config", "--global", "url.https://github.com/.insteadOf", "ssh://git@github.com/"])
|
||||
.args([
|
||||
"config",
|
||||
"--global",
|
||||
"url.https://github.com/.insteadOf",
|
||||
"ssh://git@github.com/",
|
||||
])
|
||||
.output();
|
||||
let _ = Command::new("git")
|
||||
.args(["config", "--global", "url.https://github.com/.insteadOf", "git@github.com:"])
|
||||
.args([
|
||||
"config",
|
||||
"--global",
|
||||
"url.https://github.com/.insteadOf",
|
||||
"git@github.com:",
|
||||
])
|
||||
.output();
|
||||
|
||||
let _ = app.emit("upgrade-log", format!("$ npm install -g {pkg}"));
|
||||
@@ -658,8 +668,8 @@ pub fn init_openclaw_config() -> Result<Value, String> {
|
||||
"tools": { "profile": "full", "sessions": { "visibility": "all" } }
|
||||
});
|
||||
|
||||
let content = serde_json::to_string_pretty(&default_config)
|
||||
.map_err(|e| format!("序列化失败: {e}"))?;
|
||||
let content =
|
||||
serde_json::to_string_pretty(&default_config).map_err(|e| format!("序列化失败: {e}"))?;
|
||||
std::fs::write(&config_path, content).map_err(|e| format!("写入失败: {e}"))?;
|
||||
|
||||
result.insert("created".into(), Value::Bool(true));
|
||||
@@ -749,8 +759,8 @@ pub fn scan_node_paths() -> Result<Value, String> {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let pf = std::env::var("ProgramFiles").unwrap_or_else(|_| r"C:\Program Files".into());
|
||||
let pf86 = std::env::var("ProgramFiles(x86)")
|
||||
.unwrap_or_else(|_| r"C:\Program Files (x86)".into());
|
||||
let pf86 =
|
||||
std::env::var("ProgramFiles(x86)").unwrap_or_else(|_| r"C:\Program Files (x86)".into());
|
||||
let localappdata = std::env::var("LOCALAPPDATA").unwrap_or_default();
|
||||
let appdata = std::env::var("APPDATA").unwrap_or_default();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ pub fn openclaw_dir() -> PathBuf {
|
||||
/// Tauri 应用启动时 PATH 可能不完整:
|
||||
/// - macOS 从 Finder 启动时 PATH 只有 /usr/bin:/bin:/usr/sbin:/sbin
|
||||
/// - Windows 上安装 Node.js 到非默认路径、或安装后未重启进程
|
||||
///
|
||||
/// 补充 Node.js / npm 常见安装路径
|
||||
pub fn enhanced_path() -> String {
|
||||
let current = std::env::var("PATH").unwrap_or_default();
|
||||
@@ -71,14 +72,12 @@ pub fn enhanced_path() -> String {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let pf = std::env::var("ProgramFiles").unwrap_or_else(|_| r"C:\Program Files".into());
|
||||
let pf86 = std::env::var("ProgramFiles(x86)").unwrap_or_else(|_| r"C:\Program Files (x86)".into());
|
||||
let pf86 =
|
||||
std::env::var("ProgramFiles(x86)").unwrap_or_else(|_| r"C:\Program Files (x86)".into());
|
||||
let localappdata = std::env::var("LOCALAPPDATA").unwrap_or_default();
|
||||
let appdata = std::env::var("APPDATA").unwrap_or_default();
|
||||
|
||||
let mut extra: Vec<String> = vec![
|
||||
format!(r"{}\nodejs", pf),
|
||||
format!(r"{}\nodejs", pf86),
|
||||
];
|
||||
let mut extra: Vec<String> = vec![format!(r"{}\nodejs", pf), format!(r"{}\nodejs", pf86)];
|
||||
if !localappdata.is_empty() {
|
||||
extra.push(format!(r"{}\Programs\nodejs", localappdata));
|
||||
extra.push(format!(r"{}\fnm_multishells", localappdata));
|
||||
|
||||
@@ -206,6 +206,7 @@ mod platform {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod platform {
|
||||
use std::os::windows::process::CommandExt;
|
||||
use tokio::process::Command as TokioCommand;
|
||||
|
||||
/// Windows 不需要 UID
|
||||
|
||||
Reference in New Issue
Block a user