]> source.dussan.org Git - gitea.git/commitdiff
Fix #94 and fix #169
authorUnknown <joe2010xtmf@163.com>
Sun, 11 May 2014 15:18:10 +0000 (11:18 -0400)
committerUnknown <joe2010xtmf@163.com>
Sun, 11 May 2014 15:18:10 +0000 (11:18 -0400)
conf/app.ini
modules/base/conf.go
modules/middleware/repo.go

index 4f76db4deef022bcc14849e1fee44a3397a95c00..33afae97f21f01aced716c6754ad0f4f0046148a 100644 (file)
@@ -18,6 +18,7 @@ DOMAIN = localhost
 ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
 HTTP_ADDR = 
 HTTP_PORT = 3000
+SSH_PORT = 22
 ; Disable CDN even in "prod" mode
 OFFLINE_MODE = false
 DISABLE_ROUTER_LOG = false
index 88085172c2009dd30c14161c70760480321b28f6..99bac9006f96e89f9ccf419b89af822f74e9d246 100644 (file)
@@ -49,6 +49,7 @@ var (
        AppName          string
        AppLogo          string
        AppUrl           string
+       SshPort          int
        OfflineMode      bool
        DisableRouterLog bool
        ProdMode         bool
@@ -330,6 +331,7 @@ func NewConfigContext() {
        AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png")
        AppUrl = Cfg.MustValue("server", "ROOT_URL")
        Domain = Cfg.MustValue("server", "DOMAIN")
+       SshPort = Cfg.MustInt("server", "SSH_PORT", 22)
        OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE", false)
        DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG", false)
        SecretKey = Cfg.MustValue("security", "SECRET_KEY")
index 4a10edf88110c3c7a2e2bf96f329d630dd58ce36..1516482167d961489c513a9845c27f4880d523a8 100644 (file)
@@ -153,7 +153,11 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
                ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner
                ctx.Data["BranchName"] = ""
 
-               ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
+               sshPrefix := ""
+               if base.SshPort != 22 {
+                       sshPrefix = "ssh://"
+               }
+               ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s%s@%s:%s/%s.git", sshPrefix, base.RunUser, base.Domain, user.LowerName, repo.LowerName)
                ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", base.AppUrl, user.LowerName, repo.LowerName)
                ctx.Data["CloneLink"] = ctx.Repo.CloneLink