diff --git a/scalabot-app/src/main/kotlin/AppConfigs.kt b/scalabot-app/src/main/kotlin/AppConfigs.kt index a7fa127..e6cdabb 100644 --- a/scalabot-app/src/main/kotlin/AppConfigs.kt +++ b/scalabot-app/src/main/kotlin/AppConfigs.kt @@ -7,6 +7,7 @@ import mu.KotlinLogging import net.lamgc.scalabot.util.ArtifactSerializer import net.lamgc.scalabot.util.ProxyTypeSerializer import org.eclipse.aether.artifact.Artifact +import org.eclipse.aether.repository.Proxy import org.telegram.telegrambots.bots.DefaultBotOptions import java.io.File import java.nio.charset.StandardCharsets @@ -58,7 +59,17 @@ internal data class ProxyConfig( val type: DefaultBotOptions.ProxyType = DefaultBotOptions.ProxyType.NO_PROXY, val host: String = "127.0.0.1", val port: Int = 1080 -) +) { + + fun toAetherProxy(): Proxy? { + return if (type == DefaultBotOptions.ProxyType.HTTP) { + Proxy(Proxy.TYPE_HTTP, host, port) + } else { + null + } + } + +} internal data class MetricsConfig( val enable: Boolean = false, diff --git a/scalabot-app/src/main/kotlin/ExtensionComponents.kt b/scalabot-app/src/main/kotlin/ExtensionComponents.kt index 46cb00e..7a6ebe0 100644 --- a/scalabot-app/src/main/kotlin/ExtensionComponents.kt +++ b/scalabot-app/src/main/kotlin/ExtensionComponents.kt @@ -25,7 +25,10 @@ internal class ExtensionLoader( private val finders: Set = setOf( FileNameFinder, MavenMetaInformationFinder, - MavenRepositoryExtensionFinder(LocalRepository("${System.getProperty("user.home")}/.m2/repository")) + MavenRepositoryExtensionFinder( + LocalRepository("${System.getProperty("user.home")}/.m2/repository"), + proxy = Const.config.proxy.toAetherProxy() + ) ) fun getExtensions(): Set {