Show system proxy when JVM proxy properties are set

Co-authored-by: denis0001-dev <denis0001.dev@ya.ru>
This commit is contained in:
Cursor Agent
2026-11-11 17:58:38 +00:00
Unverified
parent 8d24cec591
commit 86203db53c
2 changed files with 10 additions and 13 deletions
+8 -1
View File
@@ -441,7 +441,14 @@ compose.desktop {
// Application-level, and per host: an unqualified jvmArgs() inside
// nativeDistributions.<platform> { } lands here anyway and then leaks into every platform's
// launcher config. See hostGpuJvmArgs().
jvmArgs(*(desktopMemoryJvmArgs() + hostGpuJvmArgs() + hostScalingJvmArgs()).toTypedArray())
jvmArgs(
*(desktopMemoryJvmArgs() + hostGpuJvmArgs() + hostScalingJvmArgs()).toMutableList().apply {
if (System.getenv("FROMCHAT_TEST_SYSTEM_PROXY") == "1") {
add("-Dhttp.proxyHost=127.0.0.1")
add("-Dhttp.proxyPort=18888")
}
}.toTypedArray(),
)
buildTypes.release.proguard {
version = proguardVersion
@@ -22,24 +22,14 @@ actual fun configureEngineProxy(config: HttpClientConfig<*>, route: ProxyRoute)
}
}
/**
* Desktop JVM only: true when a system HTTP(S)/SOCKS proxy is configured (selector or JVM properties).
*/
actual fun systemProxyAvailable(): Boolean {
if (!isDesktopJvmRuntime()) return false
return jvmSystemProxyConfigured()
}
/** JVM desktop: true when a system HTTP(S)/SOCKS proxy is configured (selector or JVM properties). */
actual fun systemProxyAvailable(): Boolean = jvmSystemProxyConfigured()
actual fun systemProxyIsHttp(): Boolean {
val proxy = resolveSystemProxy() ?: return false
return proxy.type() == Proxy.Type.HTTP
}
private fun isDesktopJvmRuntime(): Boolean {
val headless = System.getProperty("java.awt.headless")?.toBooleanStrictOrNull()
return headless == false
}
internal fun jvmSystemProxyConfigured(): Boolean = resolveSystemProxy() != null
private fun resolveSystemProxy(): Proxy? {