Skip to content

feat(scripts): 为下载脚本添加网络代理和TLS证书支持#764

Open
Langren8899 wants to merge 2 commits into
ValueCell-ai:mainfrom
Langren8899:main
Open

feat(scripts): 为下载脚本添加网络代理和TLS证书支持#764
Langren8899 wants to merge 2 commits into
ValueCell-ai:mainfrom
Langren8899:main

Conversation

@Langren8899
Copy link
Copy Markdown

Summary

 添加 configureNetworkOnce 函数以支持通过环境变量配置 HTTP/HTTPS 代理和自定义 CA 证书。 新增对代理连接失败和 TLS      证书验证错误的详细错误提示,提高在企业网络环境下的可用性。

Related Issue(s)

Type of Change

  • [√] Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other

Validation

Checklist

  • [√] I ran relevant checks/tests locally.
  • I updated docs if behavior or interfaces changed.
  • I verified there are no unrelated changes in this PR.

添加 configureNetworkOnce 函数以支持通过环境变量配置 HTTP/HTTPS 代理和自定义 CA 证书。
新增对代理连接失败和 TLS 证书验证错误的详细错误提示,提高在企业网络环境下的可用性。
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3831ab558e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

#!/usr/bin/env zx

import 'zx/globals';
import { Agent, ProxyAgent, setGlobalDispatcher } from 'undici';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add undici to manifest before importing it in scripts

Both download scripts now do import { Agent, ProxyAgent, setGlobalDispatcher } from 'undici', but this commit does not add undici to the root importer dependencies/devDependencies. In pnpm’s default isolated layout, transitive packages are not reliably resolvable from project root scripts, so pnpm run uv:download / pnpm run node:download:win can fail at startup with ERR_MODULE_NOT_FOUND on fresh installs, breaking init/packaging workflows.

Useful? React with 👍 / 👎.

@Langren8899
Copy link
Copy Markdown
Author

Langren8899 commented Apr 3, 2026 via email

将 libsignal-node 依赖从 tarball URL 引用更新为 git 仓库引用,以解决潜在的依赖解析问题。同时添加 undici 作为新的运行时依赖。
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01b4bfb2b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +44 to +46
new ProxyAgent({
uri: proxy,
connect: { ca, rejectUnauthorized },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass TLS options via ProxyAgent requestTls/proxyTls

ProxyAgent does not consume AgentOptions#connect, so the connect: { ca, rejectUnauthorized } object here is ignored; undici expects TLS overrides in requestTls/proxyTls. In environments that set HTTPS_PROXY and require a custom CA (or temporarily set NODE_TLS_REJECT_UNAUTHORIZED=0), downloads will still fail TLS validation because those settings never reach proxied connections. The same pattern is duplicated in scripts/download-bundled-uv.mjs, so both download workflows are affected.

Useful? React with 👍 / 👎.

Comment on lines +53 to +55
new Agent({
connect: { ca, rejectUnauthorized },
}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve default CAs when honoring NODE_EXTRA_CA_CERTS

Passing ca explicitly into the custom Agent replaces Node’s default trust store, but NODE_EXTRA_CA_CERTS is intended to extend defaults. When users provide only their corporate root in that file (a common setup), this code drops public roots and can break downloads from nodejs.org/github.com with certificate errors. Because this logic is mirrored in scripts/download-bundled-uv.mjs, both scripts can regress under the same environment setting.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant