Skip to content

Commit 24b824b

Browse files
committed
✨ Support setting proxy URL
1 parent c2bc1c2 commit 24b824b

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ pake url [OPTIONS]...
172172

173173
# Feel free to play with Pake! It might take a while to prepare the environment the first time you launch Pake.
174174
pake https://weekly.tw93.fun --name Weekly --hide-title-bar
175-
176-
# Also supports names with spaces (cross-platform compatible)
177-
pake https://translate.google.com --name "Google Translate" --hide-title-bar
178-
179175
```
180176

181177
If you are new to the command line, you can compile packages online with _GitHub Actions_. See the [Tutorial](<https://github.com/tw93/Pake/wiki/Online-Compilation-(used-by-ordinary-users)>) for more information.

bin/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ Supports both comma-separated and multiple option formats:
259259

260260
#### [proxy-url]
261261

262-
If you need to proxy requests for some reason, you can set the proxy address using the `proxy-url` option.
262+
Set proxy server for all network requests. Supports HTTP, HTTPS, and SOCKS5.
263263

264264
```shell
265-
--proxy-url <url>
265+
--proxy-url http://127.0.0.1:7890
266+
--proxy-url socks5://127.0.0.1:7891
266267
```
267268

268269
#### [debug]

bin/README_CN.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,11 @@ pake [url] [options]
261261

262262
#### [proxy-url]
263263

264-
假如你由于某些缘故需要代理请求,你可以通过 `proxy-url` 选项来设置代理地址
264+
为所有网络请求设置代理服务器。支持 HTTP、HTTPS 和 SOCKS5
265265

266266
```shell
267-
--proxy-url <url>
267+
--proxy-url http://127.0.0.1:7890
268+
--proxy-url socks5://127.0.0.1:7891
268269
```
269270

270271
#### [debug]

bin/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ program
6868
)
6969
.option('--debug', 'Debug build and more output', DEFAULT.debug)
7070
.addOption(
71-
new Option('--proxy-url <url>', 'Proxy URL for all network requests')
71+
new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)')
7272
.default(DEFAULT_PAKE_OPTIONS.proxyUrl)
7373
.hideHelp(),
7474
)

bin/options/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function isValidName(name: string, platform: NodeJS.Platform): boolean {
2020
return !!name && reg.test(name);
2121
}
2222

23+
2324
export default async function handleOptions(
2425
options: PakeCliOptions,
2526
url: string,
@@ -56,6 +57,7 @@ export default async function handleOptions(
5657
}
5758
}
5859

60+
5961
const appOptions: PakeAppOptions = {
6062
...options,
6163
name,

src-tauri/src/app/window.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
4646
.initialization_script(include_str!("../inject/style.js"))
4747
.initialization_script(include_str!("../inject/custom.js"));
4848

49+
// Configure proxy if specified
4950
if !config.proxy_url.is_empty() {
50-
window_builder =
51-
window_builder.proxy_url(Url::from_str(config.proxy_url.as_str()).unwrap());
51+
if let Ok(proxy_url) = Url::from_str(&config.proxy_url) {
52+
window_builder = window_builder.proxy_url(proxy_url);
53+
#[cfg(debug_assertions)]
54+
println!("Proxy configured: {}", config.proxy_url);
55+
}
5256
}
5357

5458
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)