CRITICAL: api_key 'ClauderAPI2' was committed to PUBLIC unlimitedcoding repo (private:False on gitea) in 4 *_config.json + 8 ps1 scripts. Anyone on the internet could read it via curl with no auth (HTTP 200 raw access). This commit: 1. Sanitizes 4 *_config.json: api_key → "YOUR_API_KEY" + _note pointing users to private config repo for production credentials. 2. Removes 'ClauderAPI2' literal from 8 ps1 installer/updater scripts (claude/codex/gemini/qwen × install/update). Each script now has a sanitized block at top that fetches api_key from private unlimitedcoding-config repo at runtime via Authorization token. 3. Switches 6 sh installer scripts from public REPO_RAW to PRIVATE unlimitedcoding-config base URL for *_config.json downloads. 4. Removes stale .patcher.config.cache.json (will regen on next install). Production configs MOVED to private repo (separate commit e839102 on unlimitedcoding-config/main). KNOWN UNCHANGED: - releases/v2.1.119/sea/cli-wrapper.cjs still has api_key (part of npm package distribution; clients need it locally; sensey serves same). - Read-only gitea token (cadffcb0...) remains in installers — needed for token-auth fetch from private repo. Scoped read-only. RECOMMEND: api_key rotation in proxy auth list because ClauderAPI2 was publicly exposed for an unknown period. Existing client installs would need re-install or env override. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
128 lines
4.6 KiB
PowerShell
Executable File
128 lines
4.6 KiB
PowerShell
Executable File
# Claude Code - Windows Updater
|
|
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1
|
|
#
|
|
# Updates Claude Code via npm registry + re-applies config patches.
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host ""
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host " | Claude Code -- Windows Updater |" -ForegroundColor Cyan
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# >>> sanitized: api_key from private config <<<
|
|
$configToken = "cadffcb0a6a3be728ac1ff619bb40c86588f6837"
|
|
$configUrl = "https://git.sensey24.ru/aibot777/unlimitedcoding-config/raw/branch/main/patcher.config.json"
|
|
$apiKey = $env:UCLAUDE_API_KEY # respect override
|
|
if (-not $apiKey) {
|
|
try {
|
|
$resp = Invoke-WebRequest -UseBasicParsing -Uri $configUrl -Headers @{Authorization = "token $configToken"} -TimeoutSec 15
|
|
$cfg = $resp.Content | ConvertFrom-Json
|
|
if ($cfg.api_key) { $apiKey = $cfg.api_key }
|
|
} catch { Write-Warning "Config fetch failed; set `$env:UCLAUDE_API_KEY manually" }
|
|
}
|
|
# <<< end sanitized >>>
|
|
|
|
|
|
function Refresh-Path {
|
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" +
|
|
[System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
}
|
|
|
|
# ---- Check current version ----
|
|
|
|
$oldVer = "not installed"
|
|
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
try {
|
|
$oldVer = (claude --version 2>$null) -replace '[\r\n]', ''
|
|
} catch {}
|
|
}
|
|
Write-Host " Current: $oldVer" -ForegroundColor Cyan
|
|
|
|
# ---- Configure registry ----
|
|
|
|
Write-Host " Configuring npm registry..." -ForegroundColor Cyan
|
|
npm config set "@anthropic-ai:registry" "https://npm.sensey24.ru/" 2>$null
|
|
|
|
# ---- Update package ----
|
|
|
|
Write-Host " Installing latest @anthropic-ai/claude-code..." -ForegroundColor Cyan
|
|
npm install -g @anthropic-ai/claude-code 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " npm install failed. Retrying..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 3
|
|
npm install -g @anthropic-ai/claude-code 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " npm install failed." -ForegroundColor Red
|
|
Write-Host " Try: npm config set `"@anthropic-ai:registry`" `"https://npm.sensey24.ru/`"" -ForegroundColor Yellow
|
|
Write-Host " Then: npm install -g @anthropic-ai/claude-code" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
}
|
|
Refresh-Path
|
|
|
|
$newVer = "unknown"
|
|
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
try {
|
|
$newVer = (claude --version 2>$null) -replace '[\r\n]', ''
|
|
} catch {}
|
|
}
|
|
Write-Host " Updated: $oldVer -> $newVer" -ForegroundColor Green
|
|
|
|
# ---- Re-apply config patches ----
|
|
|
|
Write-Host " Setting environment variables..." -ForegroundColor Cyan
|
|
|
|
$envVars = @{
|
|
"ANTHROPIC_API_KEY" = $apiKey
|
|
"ANTHROPIC_AUTH_TOKEN" = $apiKey
|
|
"ANTHROPIC_BASE_URL" = "https://ai.37-187-136-86.sslip.io"
|
|
"ANTHROPIC_DEFAULT_OPUS_MODEL" = "claude-opus-4-7"
|
|
"ANTHROPIC_DEFAULT_SONNET_MODEL" = "claude-sonnet-4-6"
|
|
"CLAUDE_CUSTOM_MODELS" = "claude-opus-4-7,claude-opus-4-6,claude-sonnet-4-6,gpt-5.4,gpt-5.3-codex,gpt-5.2-codex,claude-opus-4-5-20251101,claude-sonnet-4-5-20250929,gemini-3.1-pro-preview,gemini-3-flash-preview,qwen3-coder-plus,qwen3-coder-flash,glm-5,glm-4.7"
|
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" = "1"
|
|
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY" = "1"
|
|
"DISABLE_TELEMETRY" = "1"
|
|
"DISABLE_ERROR_REPORTING" = "1"
|
|
"DISABLE_AUTOUPDATER" = "1"
|
|
"CLAUDE_CODE_EFFORT_LEVEL" = "high"
|
|
}
|
|
|
|
foreach ($k in $envVars.Keys) {
|
|
[System.Environment]::SetEnvironmentVariable($k, $envVars[$k], "User")
|
|
Set-Item -Path "Env:\$k" -Value $envVars[$k]
|
|
}
|
|
Write-Host " Env vars set ($($envVars.Count) variables)" -ForegroundColor Green
|
|
|
|
# ---- Re-apply settings ----
|
|
|
|
Write-Host " Configuring settings..." -ForegroundColor Cyan
|
|
$claudeDir = "$env:USERPROFILE\.claude"
|
|
New-Item -ItemType Directory -Force -Path $claudeDir | Out-Null
|
|
|
|
$settingsFile = "$claudeDir\settings.json"
|
|
$json = @'
|
|
{
|
|
"permissions": {
|
|
"allow": [
|
|
"Bash(*)",
|
|
"Read(*)",
|
|
"Write(*)",
|
|
"Edit(*)",
|
|
"Glob(*)",
|
|
"Grep(*)",
|
|
"WebFetch(*)",
|
|
"WebSearch(*)"
|
|
],
|
|
"deny": []
|
|
}
|
|
}
|
|
'@
|
|
[System.IO.File]::WriteAllText($settingsFile, $json)
|
|
Write-Host " Settings: $settingsFile" -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host " Update complete!" -ForegroundColor Green
|
|
Write-Host ""
|