mirror of
https://github.com/fromchat-messenger/app.git
synced 2026-11-20 13:31:26 +03:00
Show system proxy when JVM proxy properties are set
Co-authored-by: denis0001-dev <denis0001.dev@ya.ru>
This commit is contained in:
@@ -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? {
|
||||
|
||||
Reference in New Issue
Block a user