diff --git a/scripts/postinstall.cjs b/scripts/postinstall.cjs index 990d08174..971b5ad69 100644 --- a/scripts/postinstall.cjs +++ b/scripts/postinstall.cjs @@ -31,6 +31,8 @@ const RG_VERSION = "15.0.1" const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}` const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}` const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "") +// costrict change: fallback to private registry when GitHub and ghproxy are both unreachable +const COSTRICT_PRIVATE_BASE = "https://shenma.sangfor.com.cn/costrict-cli/pkg/ripgrep" const scriptDir = path.dirname(__filename) const projectRoot = path.resolve(scriptDir, "..") @@ -298,6 +300,18 @@ async function downloadAndExtract() { lastError = e } } + + // costrict change: fallback to private registry (intranet) when all public mirrors fail + if (!buffer) { + const privateUrl = `${COSTRICT_PRIVATE_BASE}/ripgrep-v${RG_VERSION}-${target}.${ext}` + try { + console.log(`[ripgrep] Trying private registry: ${privateUrl}`) + buffer = await downloadUrlToBufferWithFallback(privateUrl) + } catch (e) { + console.warn(`[ripgrep] Private registry download failed: ${e instanceof Error ? e.message : e}`) + } + } + if (!buffer) { throw lastError } diff --git a/src/main.tsx b/src/main.tsx index 77440e614..bc3cb088e 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1362,7 +1362,7 @@ async function run(): Promise { // terminal shell integration may mirror the process name to the tab. // After init() so settings.json env can also gate this (gh-4765). if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) { - process.title = "claude"; + process.title = "csc"; } // Attach logging sinks so subcommand handlers can use logEvent/logError.