feat(update): add CNB mirror support for China-friendly binary downloads

- Add CODEWHALE_RELEASE_BASE_URL as canonical env override for release
  asset base URL (DEEPSEEK_TUI_RELEASE_BASE_URL and DEEPSEEK_RELEASE_BASE_URL
  remain as legacy fallbacks).
- Add CODEWHALE_USE_CNB_MIRROR env var to auto-select the CNB (cnb.cool)
  mirror for binary downloads, avoiding GitHub Releases timeouts in China.
- Update npm install scripts (artifacts.js) with the same env checks.
- Update Rust self-updater (update.rs) with new constants and env cascade.

Fixes #2222.
This commit is contained in:
Hunter Bown
2026-05-26 14:19:22 -05:00
parent 4925be4dda
commit 0706285bfe
2 changed files with 34 additions and 8 deletions
+10 -1
View File
@@ -78,12 +78,21 @@ function executableName(base, platform) {
}
function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
// CODEWHALE_RELEASE_BASE_URL is the canonical override.
// DEEPSEEK_TUI_RELEASE_BASE_URL / DEEPSEEK_RELEASE_BASE_URL are legacy aliases.
const override =
process.env.DEEPSEEK_TUI_RELEASE_BASE_URL || process.env.DEEPSEEK_RELEASE_BASE_URL;
process.env.CODEWHALE_RELEASE_BASE_URL ||
process.env.DEEPSEEK_TUI_RELEASE_BASE_URL ||
process.env.DEEPSEEK_RELEASE_BASE_URL;
if (override) {
const trimmed = String(override).trim();
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
}
// When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
// mirror that already builds and publishes binary release assets.
if (process.env.CODEWHALE_USE_CNB_MIRROR) {
return `https://cnb.cool/Hmbown/CodeWhale/-/releases/v${version}/`;
}
return `https://github.com/${repo}/releases/download/v${version}/`;
}