Support setting proxy URL

This commit is contained in:
Tw93
2025-08-13 20:25:52 +08:00
parent c2bc1c2028
commit 24b824b23b
6 changed files with 15 additions and 11 deletions

5
bin/README.md vendored
View File

@@ -259,10 +259,11 @@ Supports both comma-separated and multiple option formats:
#### [proxy-url]
If you need to proxy requests for some reason, you can set the proxy address using the `proxy-url` option.
Set proxy server for all network requests. Supports HTTP, HTTPS, and SOCKS5.
```shell
--proxy-url <url>
--proxy-url http://127.0.0.1:7890
--proxy-url socks5://127.0.0.1:7891
```
#### [debug]

5
bin/README_CN.md vendored
View File

@@ -261,10 +261,11 @@ pake [url] [options]
#### [proxy-url]
假如你由于某些缘故需要代理请求,你可以通过 `proxy-url` 选项来设置代理地址
为所有网络请求设置代理服务器。支持 HTTP、HTTPS 和 SOCKS5
```shell
--proxy-url <url>
--proxy-url http://127.0.0.1:7890
--proxy-url socks5://127.0.0.1:7891
```
#### [debug]

2
bin/cli.ts vendored
View File

@@ -68,7 +68,7 @@ program
)
.option('--debug', 'Debug build and more output', DEFAULT.debug)
.addOption(
new Option('--proxy-url <url>', 'Proxy URL for all network requests')
new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)')
.default(DEFAULT_PAKE_OPTIONS.proxyUrl)
.hideHelp(),
)

View File

@@ -20,6 +20,7 @@ function isValidName(name: string, platform: NodeJS.Platform): boolean {
return !!name && reg.test(name);
}
export default async function handleOptions(
options: PakeCliOptions,
url: string,
@@ -56,6 +57,7 @@ export default async function handleOptions(
}
}
const appOptions: PakeAppOptions = {
...options,
name,