Forráskód Böngészése

[LAD] Show or hide http clone link

such tyhat we can enable or disable http cloen without having the button there
mainy for dlad integration
(see https://github.com/datalad/datalad/issues/2680#issuecomment-412152760)
cgars 6 éve
szülő
commit
f0a68e1e1f
4 módosított fájl, 6 hozzáadás és 1 törlés
  1. 2 0
      conf/app.ini
  2. 1 0
      pkg/context/repo.go
  3. 2 0
      pkg/setting/setting.go
  4. 1 1
      templates/repo/home.tmpl

+ 2 - 0
conf/app.ini

@@ -89,6 +89,8 @@ PULL_REQUEST_QUEUE_LENGTH = 1000
 PREFERRED_LICENSES = Apache License 2.0,MIT License
 ; Disable ability to interact with repositories by HTTP protocol
 DISABLE_HTTP_GIT = false
+; Show HTTP clone link
+SHOW_HTTP_GIT = false
 ; Enable ability to migrate repository by local path
 ENABLE_LOCAL_PATH_MIGRATION = false
 ; Concurrency is used to retrieve commits information. This variable define

+ 1 - 0
pkg/context/repo.go

@@ -233,6 +233,7 @@ func RepoAssignment(pages ...bool) macaron.Handler {
 
 		c.Data["DisableSSH"] = setting.SSH.Disabled
 		c.Data["DisableHTTP"] = setting.Repository.DisableHTTPGit
+		c.Data["ShowHTTP"] = setting.Repository.ShowHTTPGit
 		c.Data["CloneLink"] = repo.CloneLink()
 		c.Data["WikiCloneLink"] = repo.WikiCloneLink()
 

+ 2 - 0
pkg/setting/setting.go

@@ -114,6 +114,7 @@ var (
 	UseMSSQL      bool
 
 	// Repository settings
+	// Repository settingsS
 	Repository struct {
 		AnsiCharset              string
 		ForcePrivate             bool
@@ -122,6 +123,7 @@ var (
 		PullRequestQueueLength   int
 		PreferredLicenses        []string
 		DisableHTTPGit           bool `ini:"DISABLE_HTTP_GIT"`
+		ShowHTTPGit              bool `ini:"SHOW_HTTP_GIT"`
 		EnableLocalPathMigration bool
 		CommitsFetchConcurrency  int
 		EnableRawFileRenderMode  bool

+ 1 - 1
templates/repo/home.tmpl

@@ -62,7 +62,7 @@
 						<button class="ui basic clone button" id="repo-clone-gin" data-link="{{.CloneLink.Gin}}">
 							GIN
 						</button>
-						{{if not $.DisableHTTP}}
+						{{if and (not $.DisableHTTP) $.ShowHTTP}}
 							<button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
 								{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
 							</button>