feat: v3.0.0-beta - 切换到 portable-config 脱敏仓库 + Phase 4.5 License 激活
This commit is contained in:
parent
1b97332239
commit
1aa2c3e6ef
@ -16,7 +16,7 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# ─── 版本号 (每次更新递增, build.ps1 自动读取) ──────
|
||||
$BWVersion = "2.3.1"
|
||||
$BWVersion = "3.0.0-beta"
|
||||
|
||||
# ─── B4: 单实例保护 (防止双击两次导致竞态) ─────────
|
||||
$mutexCreated = $false
|
||||
@ -40,7 +40,7 @@ $ScriptDir = if ($PSScriptRoot) {
|
||||
}
|
||||
$ClaudeDir = Join-Path $env:USERPROFILE ".claude"
|
||||
$BackupDir = Join-Path $env:USERPROFILE ".claude.bw-backup"
|
||||
$GitUrl = "https://code.letcareme.com/bookworm/bookworm-config.git"
|
||||
$GitUrl = "https://code.letcareme.com/bookworm/bookworm-portable-config.git" # v3.0: 脱敏分发仓库
|
||||
$BootUrl = "https://code.letcareme.com/bookworm/bookworm-boot.git"
|
||||
$BootDir = Join-Path $ScriptDir "bookworm-boot"
|
||||
$SecretsEnc = Join-Path $BootDir "secrets.enc"
|
||||
@ -1261,6 +1261,41 @@ else {
|
||||
}
|
||||
} # end if (-not $secretsDecrypted)
|
||||
|
||||
# ========================================================================
|
||||
# Phase 4.5: License 激活 (v3.0 新增, 可选)
|
||||
# ========================================================================
|
||||
# 检查 ~/.claude/.bw-token 是否存在且未过期; 不存在则引导激活
|
||||
$bwTokenFile = Join-Path $ClaudeDir ".bw-token"
|
||||
$bwActivateJs = Join-Path $ClaudeDir "lib\activate.js"
|
||||
$needLicenseActivate = $true
|
||||
if (Test-Path $bwTokenFile) {
|
||||
try {
|
||||
$tok = Get-Content $bwTokenFile -Raw | ConvertFrom-Json
|
||||
if ($tok.expires_at -gt ((New-TimeSpan -Start (Get-Date "1970-01-01") -End (Get-Date).ToUniversalTime()).TotalMilliseconds + 86400000)) {
|
||||
Log-OK "License token 有效 (UUID: $($tok.license_uuid))"
|
||||
$needLicenseActivate = $false
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
if ($needLicenseActivate -and (Test-Path $bwActivateJs) -and (Test-Cmd "node")) {
|
||||
$activateChoice = Show-MsgBox "是否激活 Bookworm License (用于加载 Skill 专家)?`n`n如果有 License Key (BW-XXXX-XXXX-...), 点是`n如果没有, 点否 (可后续用 change-key.bat 激活)" "License 激活" "YesNo" "Information"
|
||||
if ($activateChoice -eq "Yes") {
|
||||
$licKey = Show-ApiKeyDialog 1 1 "" # 复用现有对话框
|
||||
if ($licKey) {
|
||||
try {
|
||||
$licKey | & node $bwActivateJs 2>&1 | Out-Null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Log-OK "License 激活成功"
|
||||
} else {
|
||||
Log-Warn "License 激活失败 (可用 change-key.bat 重试)"
|
||||
}
|
||||
} catch { Log-Warn "License 激活异常: $_" }
|
||||
}
|
||||
} else {
|
||||
Log-Info "已跳过 License 激活"
|
||||
}
|
||||
}
|
||||
|
||||
# ========================================================================
|
||||
# Phase 5: 配置渲染
|
||||
# ========================================================================
|
||||
|
||||
Loading…
Reference in New Issue
Block a user