summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--README_ZH.md2
-rw-r--r--cmd/serve.go6
-rw-r--r--conf/app.ini2
-rw-r--r--gogs.go2
-rw-r--r--models/action.go2
-rw-r--r--models/repo.go4
-rw-r--r--modules/middleware/repo.go1
-rw-r--r--modules/setting/setting.go6
-rw-r--r--templates/.VERSION2
-rw-r--r--templates/repo/header.tmpl8
11 files changed, 24 insertions, 13 deletions
diff --git a/README.md b/README.md
index 3d87e3a1ff..e93e599e71 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
![Demo](http://gogs.qiniudn.com/gogs_demo.gif)
-##### Current version: 0.5.12 Beta
+##### Current version: 0.5.13 Beta
### NOTICES
diff --git a/README_ZH.md b/README_ZH.md
index be3a2b1bc4..54e66315a8 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个基于 Go 语言的自助 Git 服务。
![Demo](http://gogs.qiniudn.com/gogs_demo.gif)
-##### 当前版本:0.5.12 Beta
+##### 当前版本:0.5.13 Beta
## 开发目的
diff --git a/cmd/serve.go b/cmd/serve.go
index 2390962342..1f5d944d4f 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -33,6 +33,12 @@ var CmdServ = cli.Command{
func setup(logPath string) {
setting.NewConfigContext()
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
+
+ if setting.DisableSSH {
+ println("Gogs: SSH has been disabled")
+ os.Exit(1)
+ }
+
models.LoadModelsConfig()
if models.UseSQLite3 {
diff --git a/conf/app.ini b/conf/app.ini
index b7a0f1a7c5..17d1a3b3b9 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -18,6 +18,8 @@ DOMAIN = localhost
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
HTTP_ADDR =
HTTP_PORT = 3000
+; Disable SSH feature when not available
+DISABLE_SSH = false
SSH_PORT = 22
; Disable CDN even in "prod" mode
OFFLINE_MODE = false
diff --git a/gogs.go b/gogs.go
index ce524af5aa..c09c4ca196 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.5.12.0206 Beta"
+const APP_VER = "0.5.13.0207 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/action.go b/models/action.go
index 34f543c4b2..a6c6cfbfaa 100644
--- a/models/action.go
+++ b/models/action.go
@@ -119,8 +119,6 @@ func (a Action) GetIssueInfos() []string {
func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, commits []*base.PushCommit) error {
for _, c := range commits {
- // FIXME: should not be a reference when it comes with action.
- // e.g. fixes #1 will not have duplicated reference message.
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
ref := ref[strings.IndexByte(ref, byte(' '))+1:]
ref = strings.TrimRightFunc(ref, func(c rune) bool {
diff --git a/models/repo.go b/models/repo.go
index b745821753..3e07adba63 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -247,8 +247,8 @@ func (repo *Repository) CloneLink() (cl CloneLink, err error) {
if err = repo.GetOwner(); err != nil {
return cl, err
}
- if setting.SshPort != 22 {
- cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.Domain, setting.SshPort, repo.Owner.LowerName, repo.LowerName)
+ if setting.SSHPort != 22 {
+ cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.Domain, setting.SSHPort, repo.Owner.LowerName, repo.LowerName)
} else {
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.Domain, repo.Owner.LowerName, repo.LowerName)
}
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index d143d8a86b..1ab158dd6d 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -386,6 +386,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner
ctx.Data["IsRepositoryTrueOwner"] = ctx.Repo.IsTrueOwner
+ ctx.Data["DisableSSH"] = setting.DisableSSH
ctx.Repo.CloneLink, err = repo.CloneLink()
if err != nil {
ctx.Handle(500, "CloneLink", err)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index e79e6d6b96..6a205921b8 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -50,7 +50,8 @@ var (
Protocol Scheme
Domain string
HttpAddr, HttpPort string
- SshPort int
+ DisableSSH bool
+ SSHPort int
OfflineMode bool
DisableRouterLog bool
CertFile, KeyFile string
@@ -209,7 +210,8 @@ func NewConfigContext() {
Domain = sec.Key("DOMAIN").MustString("localhost")
HttpAddr = sec.Key("HTTP_ADDR").MustString("0.0.0.0")
HttpPort = sec.Key("HTTP_PORT").MustString("3000")
- SshPort = sec.Key("SSH_PORT").MustInt(22)
+ DisableSSH = sec.Key("DISABLE_SSH").MustBool()
+ SSHPort = sec.Key("SSH_PORT").MustInt(22)
OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool()
StaticRootPath = sec.Key("STATIC_ROOT_PATH").MustString(workDir)
diff --git a/templates/.VERSION b/templates/.VERSION
index 99de7de73e..5a5ed364d9 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.5.12.0206 Beta \ No newline at end of file
+0.5.13.0207 Beta \ No newline at end of file
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 20e67db810..9e52efc727 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -18,9 +18,11 @@
</a>
<div id="repo-header-download-drop" class="drop-down">
<div id="repo-clone" class="clear">
- <button class="btn btn-blue left left btn-left-radius" id="repo-clone-ssh" data-link="{{$.CloneLink.SSH}}">SSH</button>
- <button class="btn btn-gray left" id="repo-clone-https" data-link="{{$.CloneLink.HTTPS}}">HTTPS</button>
- <input id="repo-clone-url" class="ipt ipt-disabled left" value="{{$.CloneLink.SSH}}" readonly />
+ {{if not $.DisableSSH}}
+ <button class="btn btn-blue left btn-left-radius" id="repo-clone-ssh" data-link="{{$.CloneLink.SSH}}">SSH</button>
+ {{end}}
+ <button class="btn {{if $.DisableSSH}}btn-blue{{else}}btn-gray{{end}} left" id="repo-clone-https" data-link="{{$.CloneLink.HTTPS}}">HTTPS</button>
+ <input id="repo-clone-url" class="ipt ipt-disabled left" value="{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly />
<button id="repo-clone-copy" class="btn btn-black left btn-right-radius" data-copy-val="val" data-copy-from="#repo-clone-url" original-title="{{$.i18n.Tr "repo.click_to_copy"}}" data-original-title="{{$.i18n.Tr "repo.click_to_copy"}}" data-after-title="{{$.i18n.Tr "repo.copied"}}">{{$.i18n.Tr "repo.copy_link"}}</button>
<p class="text-center" id="repo-clone-help">{{$.i18n.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}</p>
<hr/>