Update to use a centralized fetcher

This commit is contained in:
downthecrop 2025-11-14 23:20:00 -08:00
parent 6adc5135bc
commit 03a205f64b
9 changed files with 169 additions and 128 deletions

View file

@ -11,6 +11,7 @@ import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import javax.swing.SwingUtilities
import KondoKit.pluginmanager.GitLabConfig
import KondoKit.network.HttpFetcher
/**
* Manages downloading and installing plugins from GitLab with concurrent support
@ -127,11 +128,12 @@ object PluginDownloadManager {
}
// Create URL connection
val connection = url.openConnection() as HttpURLConnection
connection.requestMethod = "GET"
connection.setRequestProperty("User-Agent", GitLabConfig.CHROME_USER_AGENT)
// Add Accept header to avoid 406 errors
connection.setRequestProperty("Accept", "*/*")
val connection = try {
HttpFetcher.openGetConnection(url.toString())
} catch (e: Exception) {
debugLog("Failed to open connection for plugin: ${plugin.path} with URL: $downloadUrl. Error: ${e.message}")
continue
}
debugLog("Connection opened for plugin: ${plugin.path}")
debugLog("Request headers - User-Agent: ${connection.getRequestProperty("User-Agent")}")
@ -367,4 +369,4 @@ object PluginDownloadManager {
return false
}
}
}
}