fix(installer): 凭证写入用户级环境变量 (永久生效)
根因: 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) <noreply@anthropic.com>
This commit is contained in:
parent
6275ce55dc
commit
105a328120
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user