Add an optional HTTP proxy for downloads (#1474)

* Add an optional HTTP proxy for downloads

Downloads only reached GitHub directly or through URL-rewrite
mirrors, which does not help where a local proxy is the workable
route. Setup now takes a host:port HTTP proxy that every Downloader
connection uses, independently of the download source mode.

* Reference the Kotlin object instance from Java

Java cannot call a Kotlin object member on the class name without
@JvmStatic; the surrounding code already uses INSTANCE.

* Assert the proxy host literal without a reverse lookup

InetSocketAddress.getHostName reverse-resolves on some JVMs
(127.0.0.1 became localhost on CI); hostString is the literal.

* Pass the app proxy into the guest environment

The Steam client installer and the guest package tools fetch with
plain curl against their own CDNs, outside Downloader. Export the
usual proxy variables for them when the app proxy is set; proot
shares the host network, so a localhost proxy is reachable as-is.

---------

Co-authored-by: VIIII4 <VIIII4@users.noreply.github.com>
This commit is contained in:
VIIII4andVIIII4 authored and GitHub committed 2026-10-25 12:07:26 -04:00
1 parent 2be08bc67d
commit c6bc8aef04
9 files changed
+100 -1

No files matched your search

@@ -137,6 +137,7 @@ class FrontEndState(
val downloadSource: String = DownloadSource.MODE_AUTO,
val downloadMirror: String = "",
val downloadPrefix: String = "",
val downloadProxy: String = "",
val animationsEnabled: Boolean = true,
val launcherIcon: String = com.droiddeck.launcher.LauncherIcon.DARK,
val gameStoresEnabled: Boolean = true,
@@ -214,6 +215,7 @@ class FrontEndActions(
val onDownloadSource: (String) -> Unit = {},
val onDownloadMirror: (String) -> Unit = {},
val onDownloadPrefix: (String) -> Unit = {},
val onDownloadProxy: (String) -> Unit = {},
val onGameStoresEnabled: (Boolean) -> Unit = {},
val onGameStoresSpeedTier: (String) -> Unit = {},
val onNavigated: () -> Unit = {},
@@ -174,6 +174,7 @@ internal fun SetupPanel(
var showLimitDetails by rememberSaveable { mutableStateOf(false) }
var editSgdbKey by remember { mutableStateOf(false) }
var editDownloadPrefix by remember { mutableStateOf(false) }
var editDownloadProxy by remember { mutableStateOf(false) }
if (editSgdbKey) SgdbKeyDialog(s.sgdbUserKey, onSave = { a.onSgdbKey(it); editSgdbKey = false }, onDismiss = { editSgdbKey = false })
if (editDownloadPrefix) TextEntryDialog(
@@ -181,6 +182,11 @@ internal fun SetupPanel(
onDismiss = { editDownloadPrefix = false },
onSave = { a.onDownloadPrefix(it); editDownloadPrefix = false },
)
if (editDownloadProxy) TextEntryDialog(
stringResource(R.string.setup_download_proxy), s.downloadProxy,
onDismiss = { editDownloadProxy = false },
onSave = { a.onDownloadProxy(it); editDownloadProxy = false },
)
val tabs = listOf(stringResource(R.string.setup_tab_overview), stringResource(R.string.setup_tab_controller), stringResource(R.string.setup_tab_launcher), stringResource(R.string.setup_tab_storage), stringResource(R.string.setup_tab_diagnostics), stringResource(R.string.setup_tab_glasses))
var tab by rememberSaveable { mutableStateOf(if (SetupTabs.openLauncher) LAUNCHER_TAB else 0) }
SetupTabs.openLauncher = false
@@ -439,6 +445,12 @@ internal fun SetupPanel(
onClick = { editDownloadPrefix = true },
)
}
ActionRow(
stringResource(R.string.setup_download_proxy),
s.downloadProxy.takeIf { it.isNotEmpty() },
stringResource(R.string.mode_sgdb_edit),
onClick = { editDownloadProxy = true },
)
}
}
if (wide) Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.Top) {