From: Joel Johnson Date: Fri, 12 Jun 2015 23:46:31 +0000 (-0600) Subject: allow configuring of internal URLs offered X-Git-Tag: v1.7.0~1^2~58^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c20191fc0931a19bec0df1ab2b56f287e5d8b7c7;p=gitblit.git allow configuring of internal URLs offered --- diff --git a/src/main/distrib/data/defaults.properties b/src/main/distrib/data/defaults.properties index c1750689..ae519a10 100644 --- a/src/main/distrib/data/defaults.properties +++ b/src/main/distrib/data/defaults.properties @@ -1168,6 +1168,24 @@ web.forwardSlashCharacter = / # SINCE 0.5.0 web.otherUrls = +# Should HTTP/HTTPS URLs be displayed if the git servlet is enabled? +# default: true +# +# SINCE 1.7.0 +web.showHttpServletUrls = true + +# Should git URLs be displayed if the git daemon is enabled? +# default: true +# +# SINCE 1.7.0 +web.showGitDaemonUrls = true + +# Should SSH URLs be displayed if the SSH daemon is enabled? +# default: true +# +# SINCE 1.7.0 +web.showSshDaemonUrls = true + # Should app-specific clone links be displayed for SourceTree, SparkleShare, etc? # # SINCE 1.3.0 diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java index 69e5e408..5a957a17 100644 --- a/src/main/java/com/gitblit/manager/ServicesManager.java +++ b/src/main/java/com/gitblit/manager/ServicesManager.java @@ -162,7 +162,8 @@ public class ServicesManager implements IServicesManager { List list = new ArrayList(); // http/https url - if (settings.getBoolean(Keys.git.enableGitServlet, true)) { + if (settings.getBoolean(Keys.git.enableGitServlet, true) && + settings.getBoolean(Keys.web.showHttpServletUrls, true)) { AccessPermission permission = user.getRepositoryPermission(repository).permission; if (permission.exceeds(AccessPermission.NONE)) { Transport transport = Transport.fromString(request.getScheme()); @@ -177,7 +178,8 @@ public class ServicesManager implements IServicesManager { // ssh daemon url String sshDaemonUrl = getSshDaemonUrl(request, user, repository); - if (!StringUtils.isEmpty(sshDaemonUrl)) { + if (!StringUtils.isEmpty(sshDaemonUrl) && + settings.getBoolean(Keys.web.showSshDaemonUrls, true)) { AccessPermission permission = user.getRepositoryPermission(repository).permission; if (permission.exceeds(AccessPermission.NONE)) { if (permission.atLeast(AccessPermission.PUSH) && !acceptsPush(Transport.SSH)) { @@ -192,7 +194,8 @@ public class ServicesManager implements IServicesManager { // git daemon url String gitDaemonUrl = getGitDaemonUrl(request, user, repository); - if (!StringUtils.isEmpty(gitDaemonUrl)) { + if (!StringUtils.isEmpty(gitDaemonUrl) && + settings.getBoolean(Keys.web.showGitDaemonUrls, true)) { AccessPermission permission = getGitDaemonAccessPermission(user, repository); if (permission.exceeds(AccessPermission.NONE)) { if (permission.atLeast(AccessPermission.PUSH) && !acceptsPush(Transport.GIT)) {