summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-23 08:40:40 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-23 08:40:40 -0400
commit97debac18534e030924654befc6dc1eeb870a38b (patch)
tree957bc269e6dcf176f1c242e8be2a7f461daa12c8 /modules
parent97e82a0ff6286fd0a42281cd1e34dd734110e2f4 (diff)
downloadgitea-97debac18534e030924654befc6dc1eeb870a38b.tar.gz
gitea-97debac18534e030924654befc6dc1eeb870a38b.zip
SSL enable config option
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go4
-rw-r--r--modules/base/tool.go2
-rw-r--r--modules/middleware/repo.go6
3 files changed, 10 insertions, 2 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 19f587077b..fba05e8800 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -38,6 +38,8 @@ var (
RunUser string
RepoRootPath string
+ EnableHttpsClone bool
+
LogInRememberDays int
CookieUserName string
CookieRememberName string
@@ -260,6 +262,8 @@ func NewConfigContext() {
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
RunUser = Cfg.MustValue("", "RUN_USER")
+ EnableHttpsClone = Cfg.MustBool("security", "ENABLE_HTTPS_CLONE", false)
+
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
diff --git a/modules/base/tool.go b/modules/base/tool.go
index b48566f542..6d31b05252 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -519,7 +519,7 @@ func ActionDesc(act Actioner, avatarLink string) string {
buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, actUserName, repoName, commit[0], commit[0][:7], commit[1]) + "\n")
}
if push.Len > 3 {
- buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits">%d other commits >></a></div>`, actUserName, repoName, push.Len))
+ buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len))
}
return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, actUserName, repoName, branch, branch, actUserName, repoName, actUserName, repoName,
buf.String())
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 3864caaf80..eea2570ca6 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -69,8 +69,12 @@ func RepoAssignment(redirect bool) martini.Handler {
ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id)
}
ctx.Repo.Repository = repo
+ scheme := "http"
+ if base.EnableHttpsClone {
+ scheme = "https"
+ }
ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName)
- ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("https://%s/%s/%s.git", base.Domain, user.LowerName, repo.LowerName)
+ ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName)
ctx.Data["IsRepositoryValid"] = true
ctx.Data["Repository"] = repo