From 3ebc4e8e23b008de94e3d84fe1fb17b9eaeca3e7 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 15 Jul 2018 11:36:56 +0900 Subject: [PATCH 1/7] Add properties for HTTP proxy setting --- .../core/service/SystemSettingsService.scala | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala index e4247628e..099da9502 100644 --- a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala +++ b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala @@ -70,6 +70,16 @@ trait SystemSettingsService { props.setProperty(SkinName, settings.skinName.toString) props.setProperty(ShowMailAddress, settings.showMailAddress.toString) props.setProperty(PluginNetworkInstall, settings.pluginNetworkInstall.toString) + settings.proxy.foreach { proxy => + props.setProperty(ProxyHost, proxy.host) + props.setProperty(ProxyPort, proxy.port.toString) + proxy.user.foreach { user => + props.setProperty(ProxyUser, user) + } + proxy.password.foreach { password => + props.setProperty(ProxyPassword, password) + } + } using(new java.io.FileOutputStream(GitBucketConf)) { out => props.store(out, null) @@ -112,9 +122,7 @@ trait SystemSettingsService { getOptionValue(props, SmtpFromName, None) ) ) - } else { - None - }, + } else None, getValue(props, LdapAuthentication, false), if (getValue(props, LdapAuthentication, false)) { Some( @@ -133,9 +141,7 @@ trait SystemSettingsService { getOptionValue(props, LdapKeystore, None) ) ) - } else { - None - }, + } else None, getValue(props, OidcAuthentication, false), if (getValue(props, OidcAuthentication, false)) { Some( @@ -151,7 +157,17 @@ trait SystemSettingsService { }, getValue(props, SkinName, "skin-blue"), getValue(props, ShowMailAddress, false), - getValue(props, PluginNetworkInstall, false) + getValue(props, PluginNetworkInstall, false), + if (getValue(props, ProxyHost, "").nonEmpty) { + Some( + Proxy( + getValue(props, ProxyHost, ""), + getValue(props, ProxyPort, 8080), + getOptionValue(props, ProxyUser, None), + getOptionValue(props, ProxyPassword, None) + ) + ) + } else None ) } } @@ -181,7 +197,8 @@ object SystemSettingsService { oidc: Option[OIDC], skinName: String, showMailAddress: Boolean, - pluginNetworkInstall: Boolean + pluginNetworkInstall: Boolean, + proxy: Option[Proxy] ) { def baseUrl(request: HttpServletRequest): String = @@ -249,6 +266,13 @@ object SystemSettingsService { fromName: Option[String] ) + case class Proxy( + host: String, + port: Int, + user: Option[String], + password: Option[String], + ) + case class SshAddress(host: String, port: Int, genericUser: String) case class Lfs(serverUrl: Option[String]) @@ -298,6 +322,10 @@ object SystemSettingsService { private val SkinName = "skinName" private val ShowMailAddress = "showMailAddress" private val PluginNetworkInstall = "plugin.networkInstall" + private val ProxyHost = "proxy.host" + private val ProxyPort = "proxy.port" + private val ProxyUser = "proxy.user" + private val ProxyPassword = "proxy.password" private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = { getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse { From 31345cc73925b19e2424ba5de570c050e7660d7b Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 15 Jul 2018 12:52:22 +0900 Subject: [PATCH 2/7] Add proxy support for plugin installation --- .../controller/SystemSettingsController.scala | 18 ++++--- .../core/plugin/PluginRepository.scala | 27 +++++++++- .../gitbucket/core/admin/plugins.scala.html | 2 - .../gitbucket/core/admin/settings.scala.html | 7 +++ .../core/admin/settings_plugins.scala.html | 52 +++++++++++++++++++ 5 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html diff --git a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala index a235d78a4..69168ecc5 100644 --- a/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/SystemSettingsController.scala @@ -94,9 +94,16 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase { ), "skinName" -> trim(label("AdminLTE skin name", text(required))), "showMailAddress" -> trim(label("Show mail address", boolean())), - "pluginNetworkInstall" -> new SingleValueType[Boolean] { - override def convert(value: String, messages: Messages): Boolean = context.settings.pluginNetworkInstall - } + "pluginNetworkInstall" -> trim(label("Network plugin installation", boolean())), + "proxy" -> optionalIfNotChecked( + "useProxy", + mapping( + "host" -> trim(label("Proxy host", text(required))), + "port" -> trim(label("Proxy port", number())), + "user" -> trim(label("Keystore", optional(text()))), + "password" -> trim(label("Keystore", optional(text()))) + )(Proxy.apply) + ) )(SystemSettings.apply).verifying { settings => Vector( if (settings.ssh.enabled && settings.baseUrl.isEmpty) { @@ -380,11 +387,6 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase { }) post("/admin/plugins/_reload")(adminOnly { - // Update configuration - val pluginNetworkInstall = params.get("pluginNetworkInstall").map(_.toBoolean).getOrElse(false) - saveSystemSettings(context.settings.copy(pluginNetworkInstall = pluginNetworkInstall)) - - // Reload plugins PluginRegistry.reload(request.getServletContext(), loadSystemSettings(), request2Session(request).conn) flash += "info" -> "All plugins were reloaded." redirect("/admin/plugins") diff --git a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala index 22208ea20..c1e4b4858 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala @@ -1,7 +1,12 @@ package gitbucket.core.plugin +import java.net.{InetSocketAddress, PasswordAuthentication} +import java.net.{Proxy => JProxy} + +import gitbucket.core.controller.Context import org.json4s._ import org.apache.commons.io.IOUtils +import java.net.Authenticator object PluginRepository { implicit val formats = DefaultFormats @@ -10,9 +15,27 @@ object PluginRepository { org.json4s.jackson.JsonMethods.parse(json).extract[Seq[PluginMetadata]] } - def getPlugins(): Seq[PluginMetadata] = { + def getPlugins()(implicit context: Context): Seq[PluginMetadata] = { val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json") - val str = IOUtils.toString(url, "UTF-8") + + val in = context.settings.proxy match { + case Some(proxy) => + (proxy.user, proxy.password) match { + case (Some(user), Some(password)) => + Authenticator.setDefault(new Authenticator() { + override def getPasswordAuthentication = new PasswordAuthentication(user, password.toCharArray) + }) + case _ => + Authenticator.setDefault(null) + } + + url + .openConnection(new JProxy(JProxy.Type.HTTP, new InetSocketAddress(proxy.host, proxy.port))) + .getInputStream + case None => url.openStream() + } + + val str = IOUtils.toString(in, "UTF-8") parsePluginJson(str) } diff --git a/src/main/twirl/gitbucket/core/admin/plugins.scala.html b/src/main/twirl/gitbucket/core/admin/plugins.scala.html index f95ad250d..afe2f8304 100644 --- a/src/main/twirl/gitbucket/core/admin/plugins.scala.html +++ b/src/main/twirl/gitbucket/core/admin/plugins.scala.html @@ -3,8 +3,6 @@ @gitbucket.core.admin.html.menu("plugins") { @gitbucket.core.helper.html.information(info)
- -

Plugins

diff --git a/src/main/twirl/gitbucket/core/admin/settings.scala.html b/src/main/twirl/gitbucket/core/admin/settings.scala.html index 346b4652a..dd9eeba27 100644 --- a/src/main/twirl/gitbucket/core/admin/settings.scala.html +++ b/src/main/twirl/gitbucket/core/admin/settings.scala.html @@ -8,6 +8,7 @@
@@ -16,6 +17,9 @@
@settings_authentication(info)
+
+ @settings_plugins(info) +

@@ -30,6 +34,9 @@ $(function(){ if(location.hash == '#authentication'){ $('li:has(a[href="#authentication"])').addClass('active'); $('div#authentication').addClass('active'); + } else if(location.hash == '#plugins'){ + $('li:has(a[href="#plugins"])').addClass('active'); + $('div#plugins').addClass('active'); } else { $('li:has(a[href="#system"])').addClass('active'); $('div#system').addClass('active'); diff --git a/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html b/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html new file mode 100644 index 000000000..ec767cc2e --- /dev/null +++ b/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html @@ -0,0 +1,52 @@ +@(info: Option[Any])(implicit context: gitbucket.core.controller.Context) + +
+ +
+
+
+ +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ From 3920dfb57e96a6d9efec75235a3a95701cd41194 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 15 Jul 2018 13:03:04 +0900 Subject: [PATCH 3/7] Fix testcase --- .../scala/gitbucket/core/view/AvatarImageProviderSpec.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala b/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala index c0a0a0c40..2ca4ae62f 100644 --- a/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala +++ b/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala @@ -138,7 +138,8 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar { oidc = None, skinName = "skin-blue", showMailAddress = false, - pluginNetworkInstall = false + pluginNetworkInstall = false, + proxy = None ) /** From 16097bff947a2e0ccdfe794a27ab458c2a758fb6 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Tue, 17 Jul 2018 00:52:14 +0900 Subject: [PATCH 4/7] Use load pattern to handle InputStream --- .../scala/gitbucket/core/plugin/PluginRepository.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala index 3aac3e832..8c8ac5dc1 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala @@ -4,6 +4,7 @@ import java.net.{InetSocketAddress, PasswordAuthentication} import java.net.{Proxy => JProxy} import gitbucket.core.controller.Context +import gitbucket.core.util.SyntaxSugars.using import org.json4s._ import org.apache.commons.io.IOUtils @@ -21,7 +22,7 @@ object PluginRepository { def getPlugins()(implicit context: Context): Seq[PluginMetadata] = { try { val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json") - val in = context.settings.proxy match { + using(context.settings.proxy match { case Some(proxy) => (proxy.user, proxy.password) match { case (Some(user), Some(password)) => @@ -31,15 +32,14 @@ object PluginRepository { case _ => Authenticator.setDefault(null) } - url .openConnection(new JProxy(JProxy.Type.HTTP, new InetSocketAddress(proxy.host, proxy.port))) .getInputStream - case None => url.openStream() + }) { in => + val str = IOUtils.toString(in, "UTF-8") + parsePluginJson(str) } - val str = IOUtils.toString(in, "UTF-8") - parsePluginJson(str) } catch { case t: Throwable => logger.warn("Failed to access to the plugin repository: " + t.toString) From 45a1af2cd7d0cef9fca3a0fc39c40b237189efcd Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 29 Jul 2018 12:58:20 +0900 Subject: [PATCH 5/7] Use Apache HttpComponents instead of URL.openStream --- .../core/plugin/PluginRegistry.scala | 17 ++++++++-- .../core/plugin/PluginRepository.scala | 33 +++++++----------- .../gitbucket/core/util/HttpClientUtil.scala | 34 +++++++++++++++++++ 3 files changed, 61 insertions(+), 23 deletions(-) create mode 100644 src/main/scala/gitbucket/core/util/HttpClientUtil.scala diff --git a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala index fb0d39e80..6ed9dbca1 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala @@ -6,8 +6,8 @@ import java.nio.file.{Files, Paths, StandardWatchEventKinds} import java.util.Base64 import java.util.concurrent.ConcurrentLinkedQueue import java.util.concurrent.ConcurrentHashMap -import javax.servlet.ServletContext +import javax.servlet.ServletContext import com.github.zafarkhaja.semver.Version import gitbucket.core.controller.{Context, ControllerBase} import gitbucket.core.model.{Account, Issue} @@ -18,10 +18,12 @@ import gitbucket.core.service.SystemSettingsService.SystemSettings import gitbucket.core.util.SyntaxSugars._ import gitbucket.core.util.DatabaseConfig import gitbucket.core.util.Directory._ +import gitbucket.core.util.HttpClientUtil._ import io.github.gitbucket.solidbase.Solidbase import io.github.gitbucket.solidbase.manager.JDBCVersionManager import io.github.gitbucket.solidbase.model.Module import org.apache.commons.io.FileUtils +import org.apache.http.client.methods.HttpGet import org.apache.sshd.server.Command import org.slf4j.LoggerFactory import play.twirl.api.Html @@ -253,8 +255,17 @@ object PluginRegistry { }) .foreach(_.delete()) - val in = url.openStream() - FileUtils.copyToFile(in, new File(PluginHome, new File(url.getFile).getName)) + withHttpClient(settings.proxy) { httpClient => + val httpGet = new HttpGet(url.toString) + try { + val response = httpClient.execute(httpGet) + val in = response.getEntity.getContent + FileUtils.copyToFile(in, new File(PluginHome, new File(url.getFile).getName)) + } finally { + httpGet.releaseConnection() + } + } + instance = new PluginRegistry() initialize(context, settings, conn) } diff --git a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala index 8c8ac5dc1..56a49f693 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala @@ -1,14 +1,12 @@ package gitbucket.core.plugin -import java.net.{InetSocketAddress, PasswordAuthentication} -import java.net.{Proxy => JProxy} - import gitbucket.core.controller.Context import gitbucket.core.util.SyntaxSugars.using +import gitbucket.core.util.HttpClientUtil._ import org.json4s._ import org.apache.commons.io.IOUtils -import java.net.Authenticator +import org.apache.http.client.methods.HttpGet import org.slf4j.LoggerFactory object PluginRepository { @@ -22,23 +20,18 @@ object PluginRepository { def getPlugins()(implicit context: Context): Seq[PluginMetadata] = { try { val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json") - using(context.settings.proxy match { - case Some(proxy) => - (proxy.user, proxy.password) match { - case (Some(user), Some(password)) => - Authenticator.setDefault(new Authenticator() { - override def getPasswordAuthentication = new PasswordAuthentication(user, password.toCharArray) - }) - case _ => - Authenticator.setDefault(null) + + withHttpClient(context.settings.proxy) { httpClient => + val httpGet = new HttpGet(url.toString) + try { + val response = httpClient.execute(httpGet) + using(response.getEntity.getContent) { in => + val str = IOUtils.toString(in, "UTF-8") + parsePluginJson(str) } - url - .openConnection(new JProxy(JProxy.Type.HTTP, new InetSocketAddress(proxy.host, proxy.port))) - .getInputStream - case None => url.openStream() - }) { in => - val str = IOUtils.toString(in, "UTF-8") - parsePluginJson(str) + } finally { + httpGet.releaseConnection() + } } } catch { case t: Throwable => diff --git a/src/main/scala/gitbucket/core/util/HttpClientUtil.scala b/src/main/scala/gitbucket/core/util/HttpClientUtil.scala new file mode 100644 index 000000000..3e8940026 --- /dev/null +++ b/src/main/scala/gitbucket/core/util/HttpClientUtil.scala @@ -0,0 +1,34 @@ +package gitbucket.core.util + +import gitbucket.core.service.SystemSettingsService +import org.apache.http.HttpHost +import org.apache.http.auth.{AuthScope, UsernamePasswordCredentials} +import org.apache.http.impl.client.{BasicCredentialsProvider, CloseableHttpClient, HttpClientBuilder} + +object HttpClientUtil { + + def withHttpClient[T](proxy: Option[SystemSettingsService.Proxy])(f: CloseableHttpClient => T): T = { + val builder = HttpClientBuilder.create.useSystemProperties + + proxy.foreach { proxy => + for (user <- proxy.user; password <- proxy.password) { + builder.setProxy(new HttpHost(proxy.host, proxy.port)) + val credential = new BasicCredentialsProvider() + credential.setCredentials( + new AuthScope(proxy.host, proxy.port), + new UsernamePasswordCredentials(user, password) + ) + builder.setDefaultCredentialsProvider(credential) + } + } + + val httpClient = builder.build() + + try { + f(httpClient) + } finally { + httpClient.close() + } + } + +} From 04823666b68f0cc44f5fc7a2f503acaaa97f845f Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 29 Jul 2018 13:15:53 +0900 Subject: [PATCH 6/7] Fixup --- src/main/scala/gitbucket/core/util/HttpClientUtil.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/util/HttpClientUtil.scala b/src/main/scala/gitbucket/core/util/HttpClientUtil.scala index 3e8940026..b01d4353c 100644 --- a/src/main/scala/gitbucket/core/util/HttpClientUtil.scala +++ b/src/main/scala/gitbucket/core/util/HttpClientUtil.scala @@ -11,8 +11,9 @@ object HttpClientUtil { val builder = HttpClientBuilder.create.useSystemProperties proxy.foreach { proxy => + builder.setProxy(new HttpHost(proxy.host, proxy.port)) + for (user <- proxy.user; password <- proxy.password) { - builder.setProxy(new HttpHost(proxy.host, proxy.port)) val credential = new BasicCredentialsProvider() credential.setCredentials( new AuthScope(proxy.host, proxy.port), From 4cb04e9cc3464f45fe0bff4ee4d62a5081e95fbb Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Mon, 30 Jul 2018 10:34:38 +0900 Subject: [PATCH 7/7] Change configuration keys --- .../core/plugin/PluginRegistry.scala | 2 +- .../core/plugin/PluginRepository.scala | 2 +- .../core/service/SystemSettingsService.scala | 30 +++++++++---------- .../core/admin/settings_plugins.scala.html | 10 +++---- .../core/view/AvatarImageProviderSpec.scala | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala index 6ed9dbca1..6964732da 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRegistry.scala @@ -255,7 +255,7 @@ object PluginRegistry { }) .foreach(_.delete()) - withHttpClient(settings.proxy) { httpClient => + withHttpClient(settings.pluginProxy) { httpClient => val httpGet = new HttpGet(url.toString) try { val response = httpClient.execute(httpGet) diff --git a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala index 56a49f693..1e72ca802 100644 --- a/src/main/scala/gitbucket/core/plugin/PluginRepository.scala +++ b/src/main/scala/gitbucket/core/plugin/PluginRepository.scala @@ -21,7 +21,7 @@ object PluginRepository { try { val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json") - withHttpClient(context.settings.proxy) { httpClient => + withHttpClient(context.settings.pluginProxy) { httpClient => val httpGet = new HttpGet(url.toString) try { val response = httpClient.execute(httpGet) diff --git a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala index 099da9502..a4df2bb16 100644 --- a/src/main/scala/gitbucket/core/service/SystemSettingsService.scala +++ b/src/main/scala/gitbucket/core/service/SystemSettingsService.scala @@ -70,14 +70,14 @@ trait SystemSettingsService { props.setProperty(SkinName, settings.skinName.toString) props.setProperty(ShowMailAddress, settings.showMailAddress.toString) props.setProperty(PluginNetworkInstall, settings.pluginNetworkInstall.toString) - settings.proxy.foreach { proxy => - props.setProperty(ProxyHost, proxy.host) - props.setProperty(ProxyPort, proxy.port.toString) + settings.pluginProxy.foreach { proxy => + props.setProperty(PluginProxyHost, proxy.host) + props.setProperty(PluginProxyPort, proxy.port.toString) proxy.user.foreach { user => - props.setProperty(ProxyUser, user) + props.setProperty(PluginProxyUser, user) } proxy.password.foreach { password => - props.setProperty(ProxyPassword, password) + props.setProperty(PluginProxyPassword, password) } } @@ -158,13 +158,13 @@ trait SystemSettingsService { getValue(props, SkinName, "skin-blue"), getValue(props, ShowMailAddress, false), getValue(props, PluginNetworkInstall, false), - if (getValue(props, ProxyHost, "").nonEmpty) { + if (getValue(props, PluginProxyHost, "").nonEmpty) { Some( Proxy( - getValue(props, ProxyHost, ""), - getValue(props, ProxyPort, 8080), - getOptionValue(props, ProxyUser, None), - getOptionValue(props, ProxyPassword, None) + getValue(props, PluginProxyHost, ""), + getValue(props, PluginProxyPort, 8080), + getOptionValue(props, PluginProxyUser, None), + getOptionValue(props, PluginProxyPassword, None) ) ) } else None @@ -198,7 +198,7 @@ object SystemSettingsService { skinName: String, showMailAddress: Boolean, pluginNetworkInstall: Boolean, - proxy: Option[Proxy] + pluginProxy: Option[Proxy] ) { def baseUrl(request: HttpServletRequest): String = @@ -322,10 +322,10 @@ object SystemSettingsService { private val SkinName = "skinName" private val ShowMailAddress = "showMailAddress" private val PluginNetworkInstall = "plugin.networkInstall" - private val ProxyHost = "proxy.host" - private val ProxyPort = "proxy.port" - private val ProxyUser = "proxy.user" - private val ProxyPassword = "proxy.password" + private val PluginProxyHost = "plugin.proxy.host" + private val PluginProxyPort = "plugin.proxy.port" + private val PluginProxyUser = "plugin.proxy.user" + private val PluginProxyPassword = "plugin.proxy.password" private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = { getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse { diff --git a/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html b/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html index ec767cc2e..0ca1053d2 100644 --- a/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html +++ b/src/main/twirl/gitbucket/core/admin/settings_plugins.scala.html @@ -9,7 +9,7 @@
@@ -17,28 +17,28 @@
- +
- +
- +
- +
diff --git a/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala b/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala index 2ca4ae62f..f967b0cc5 100644 --- a/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala +++ b/src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala @@ -139,7 +139,7 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar { skinName = "skin-blue", showMailAddress = false, pluginNetworkInstall = false, - proxy = None + pluginProxy = None ) /**