Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAC (proxy auto-config) for WebView #3171

Open
maoist2009 opened this issue Feb 8, 2025 · 5 comments
Open

PAC (proxy auto-config) for WebView #3171

maoist2009 opened this issue Feb 8, 2025 · 5 comments
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.

Comments

@maoist2009
Copy link

What is the problem or limitation you are having?

I want to set pac (auto proxy) of webview.

Describe the solution you'd like

Maybe a switch like user-agent.

On windows webview 2, i've written one(not python), it use an chromium command line swtich

 --proxy-pac-url=http://127.0.0.1:4008/proxy.pac

to start webview2.

On android webview, jetpack supports proxy setting but i don't know whether pac is provided. refrences

Describe alternatives you've considered

If it is not supported, maybe we need to deal with the http requets manually.

Additional context

No response

@maoist2009 maoist2009 added the enhancement New features, or improvements to existing features. label Feb 8, 2025
@freakboy3742 freakboy3742 added the not quite right The idea or PR has been reviewed, but more work is needed. label Feb 9, 2025
@freakboy3742
Copy link
Member

I'm not fundamentally opposed to adding support for proxy configuration; however this is going to need a lot more research to determine what is actually possible across the platforms we support. Unless there's a prospect of supporting this on at least some platforms through a publicly available API, there's not much we can do.

@maoist2009
Copy link
Author

So is there anyway to directly interact with android webview like we do in java or kotlin?

@freakboy3742
Copy link
Member

Well... yes... that's how Toga works. It's invoking Android APIs using the Chaquopy bridge.

@maoist2009
Copy link
Author

So, if i want to add google maven

https://developer.android.com/jetpack/androidx/releases/webkit

How should i specify briefscape?.

@freakboy3742
Copy link
Member

I'm afraid I can't read Chinese, so I have a limited ability to understand what you're linking there.

If you're asking the general question about how to access an Android API - you use the Chaquopy API I linked earlier, and modify the build_gradle_dependencies setting in your Briefcase configuration to ensure any dependencies are included. Briefcase's Toga template already does this for androidx.swiperefreshlayout. You'd need to use similar handling to include androidx.webkit.

It's also worth noting that Toga isn't using androidx.webkit; it's using android.webview.

It might be possible to modify toga-android to use a jetpack androidx webkit view, but that would require a substantial rewrite of the Toga-android WebView widget.

@mhsmith mhsmith changed the title [Feature request] PAC for webview. PAC (proxy auto-config) for WebView Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.
Projects
None yet
Development

No branches or pull requests

2 participants