-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(macos): support proxy * Added WebView2 implementation * Update mod.rs * Added Webkit2gtk implementation * chore: update doc and format * fix(macos): use TryFrom trait for nw_endpoint_t * fix(macos): add `mac-proxy` feature flag to enable proxy feature for macOS 14.0+ * chore: fix clippy * Change WebView2 argument construction to before async operation * Update src/webview/mod.rs Co-authored-by: Amr Bashir <[email protected]> * Remove unused import * update formatting * Added documentation at with_additional_browser_args * refactor: remove redundant proxy struct * Remove redundant reference * hide proxy module and export types needed --------- Co-authored-by: DK Liao <[email protected]> Co-authored-by: Amr Bashir <[email protected]>
- Loading branch information
1 parent
70d8ae0
commit 3cc4d79
Showing
9 changed files
with
244 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
use wry::webview::{ProxyConfig, ProxyEndpoint}; | ||
|
||
fn main() -> wry::Result<()> { | ||
use wry::{ | ||
application::{ | ||
event::{Event, StartCause, WindowEvent}, | ||
event_loop::{ControlFlow, EventLoop}, | ||
window::WindowBuilder, | ||
}, | ||
webview::WebViewBuilder, | ||
}; | ||
|
||
let event_loop = EventLoop::new(); | ||
let window = WindowBuilder::new() | ||
.with_title("Proxy Test") | ||
.build(&event_loop)?; | ||
|
||
let http_proxy = ProxyConfig::Http(ProxyEndpoint { | ||
host: "localhost".to_string(), | ||
port: "3128".to_string(), | ||
}); | ||
|
||
let _webview = WebViewBuilder::new(window)? | ||
.with_proxy_config(http_proxy) | ||
.with_url("https://www.myip.com/")? | ||
.build()?; | ||
|
||
event_loop.run(move |event, _, control_flow| { | ||
*control_flow = ControlFlow::Wait; | ||
|
||
match event { | ||
Event::NewEvents(StartCause::Init) => println!("Wry has started!"), | ||
Event::WindowEvent { | ||
event: WindowEvent::CloseRequested, | ||
.. | ||
} => *control_flow = ControlFlow::Exit, | ||
_ => (), | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#[derive(Debug, Clone)] | ||
pub struct ProxyEndpoint { | ||
/// Proxy server host (e.g. 192.168.0.100, localhost, example.com, etc.) | ||
pub host: String, | ||
/// Proxy server port (e.g. 1080, 3128, etc.) | ||
pub port: String, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum ProxyConfig { | ||
/// Connect to proxy server via HTTP CONNECT | ||
Http(ProxyEndpoint), | ||
/// Connect to proxy server via SOCKSv5 | ||
Socks5(ProxyEndpoint), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.