From 105a3281200f18d35d493c909cd8180f8734396c Mon Sep 17 00:00:00 2001 From: bookworm Date: Fri, 10 Apr 2026 10:54:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(installer):=20=E5=87=AD=E8=AF=81=E5=86=99?= =?UTF-8?q?=E5=85=A5=E7=94=A8=E6=88=B7=E7=BA=A7=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=20(=E6=B0=B8=E4=B9=85=E7=94=9F=E6=95=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: auto-setup.ps1 用 DPAPI 缓存凭证, 但 install.ps1 (bat 调用) 未同步更新, 导致桌面快捷方式启动时凭证无法加载. 修复: Phase 4 解密成功后同时写入 Process + User 级环境变量. 用户在任何终端直接输入 claude 即可启动, 无需通过 bat 启动. 移除 "缓存至 23:59" 选项 (不再需要, User 环境变量本身就是持久的). Co-Authored-By: Claude Opus 4.6 (1M context) --- auto-setup.ps1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/auto-setup.ps1 b/auto-setup.ps1 index d581602..d422914 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -998,19 +998,17 @@ elseif ((Test-Path $SecretsEnc) -or (Get-ChildItem $BootDir -Filter "secrets-*.e $key = ($line -split '=', 2)[0].Trim() $value = ($line -split '=', 2)[1].Trim() if ($key -and $value) { + # 写入 Process (当前进程立即生效) + User (永久, 新终端也可用) [System.Environment]::SetEnvironmentVariable($key, $value, "Process") - Log-OK "已注入: $key" + [System.Environment]::SetEnvironmentVariable($key, $value, "User") + Log-OK "已注入: $key (永久)" $count++ } } $decrypted = $null $secretsDecrypted = $true - $cacheResult = Show-MsgBox "授权码验证成功 ($count 个凭证)。`n`n是否缓存至今日 23:59?`n(下次启动免输授权码)" "本日免密" "YesNo" "Question" - if ($cacheResult -eq "Yes") { - Save-SecretsToCache - Log-OK "凭证已缓存至今日 23:59" - } + Show-MsgBox "授权码验证成功!`n`n$count 个凭证已写入系统环境变量 (永久生效)。`n任何终端输入 claude 即可启动,无需再次输入授权码。" "验证成功" "OK" "Information" break } else { $token = $null