]> source.dussan.org Git - gitea.git/commitdiff
SSL enable config option
authorUnknown <joe2010xtmf@163.com>
Sun, 23 Mar 2014 12:40:40 +0000 (08:40 -0400)
committerUnknown <joe2010xtmf@163.com>
Sun, 23 Mar 2014 12:40:40 +0000 (08:40 -0400)
12 files changed:
README.md
README_ZH.md
conf/app.ini
gogs.go
models/user.go
modules/base/conf.go
modules/base/tool.go
modules/middleware/repo.go
routers/admin/admin.go
routers/dashboard.go
templates/admin/config.tmpl
templates/status/404.tmpl

index e947d7739a04b351fb284d01d06c3e6a15d7decb..42eba6362da498d06111888258f7456b55096ee5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
 
 ![Demo](http://gowalker.org/public/gogs_demo.gif)
 
-##### Current version: 0.1.6 Alpha
+##### Current version: 0.1.7 Alpha
 
 #### Other language version
 
@@ -27,7 +27,7 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
 ## Features
 
 - Activity timeline
-- SSH protocol support.
+- SSH/HTTPS protocol support.
 - Register/delete account.
 - Create/delete/watch public repository.
 - User profile page.
index 78e26fada45d7140344960877038c715baca15bd..b405e04198c86e619ad2bd245fd0a3bcdad08aee 100644 (file)
@@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。
 
 ![Demo](http://gowalker.org/public/gogs_demo.gif)
 
-##### 当前版本:0.1.6 Alpha
+##### 当前版本:0.1.7 Alpha
 
 ## 开发目的
 
@@ -23,7 +23,7 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
 ## 功能特性
 
 - 活动时间线
-- SSH 协议支持
+- SSH/HTTPS 协议支持
 - 注册/删除用户
 - 创建/删除/关注公开仓库
 - 用户个人信息页面
index b051557f41b4b3f56fea6a961b34e70257bb966d..ab9f6dc4bb55872e766495ebd17d3818b6b6bbfb 100644 (file)
@@ -32,6 +32,8 @@ PATH = data/gogs.db
 [admin]
 
 [security]
+; Use HTTPS to clone repository, otherwise use HTTP.
+ENABLE_HTTPS_CLONE = false
 ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
 SECRET_KEY = !#@FDEWREWR&*(
 ; Auto-login remember days
diff --git a/gogs.go b/gogs.go
index 0bdbbc0697e31c40ca76156151114d356aa7ffca..09b28f9b3f7f8f2c67d92cecc450aa2091b3b130 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -20,7 +20,7 @@ import (
 // Test that go1.2 tag above is included in builds. main.go refers to this definition.
 const go12tag = true
 
-const APP_VER = "0.1.6.0323.1"
+const APP_VER = "0.1.7.0323.1"
 
 func init() {
        base.AppVer = APP_VER
index 9333d1ee678915d9d632f132874e523a32d82f7f..c9d6e613036461c749fe3accc7494ee45dc7297e 100644 (file)
@@ -208,7 +208,7 @@ func UpdateUser(user *User) (err error) {
                user.Website = user.Website[:255]
        }
 
-       _, err = orm.Id(user.Id).UseBool().Cols("website", "location").Update(user)
+       _, err = orm.Id(user.Id).UseBool().Cols("website", "location", "is_active", "is_admin").Update(user)
        return err
 }
 
index 19f587077b1f36718dd4c130e7c50e60993d991f..fba05e88000fcac9ccb347a1d909697ec0a7dc61 100644 (file)
@@ -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")
index b48566f542ce725a7db15b8b3cec4aed32ab8204..6d31b052522fd655964e79b68b19905db3b518cf 100644 (file)
@@ -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())
index 3864caaf8000a54ce23e44b9887f6d427d2648e6..eea2570ca638f5a9d6e2d20c3ec434c42aa0b7ec 100644 (file)
@@ -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
index c0f39f715924d061fc79fe76c221e1839d9a9c2a..f1f951ef259bbc4016af2768936eb75ebf98a681 100644 (file)
@@ -141,6 +141,7 @@ func Config(ctx *middleware.Context) {
        ctx.Data["Domain"] = base.Domain
        ctx.Data["RunUser"] = base.RunUser
        ctx.Data["RunMode"] = strings.Title(martini.Env)
+       ctx.Data["EnableHttpsClone"] = base.EnableHttpsClone
        ctx.Data["RepoRootPath"] = base.RepoRootPath
 
        ctx.Data["Service"] = base.Service
index dafe9f31ec917fba6f3c8df4c2d3006b8c23ff42..76ecc3f676ee66505bba2336071ba896fb2e21d9 100644 (file)
@@ -26,6 +26,6 @@ func Help(ctx *middleware.Context) {
 
 func NotFound(ctx *middleware.Context) {
        ctx.Data["PageIsNotFound"] = true
-       ctx.Data["Title"] = 404
+       ctx.Data["Title"] = "Page Not Found"
        ctx.Handle(404, "home.NotFound", nil)
 }
index 048740e617b1e5d3a69baaa2b90f7ec0dd4646c5..915c9dc088b1ea9641255bcaea0f4f247f5f8a8f 100644 (file)
@@ -17,6 +17,7 @@
                 <div><b>Run User:</b> {{.RunUser}}</div>
                 <div><b>Run Mode:</b> {{.RunMode}}</div>
                 <hr/>
+                <div><b>Enable HTTPS Clone</b> <i class="fa fa{{if .EnableHttpsClone}}-check{{end}}-square-o"></i></div>
                 <div><b>Repository Root Path:</b> {{.RepoRootPath}}</div>
             </div>
         </div>
index c2cafe0c9dd08301d376aea3033e3bfca89cf43c..b971f279a811d28a5216c9234ab9a5f6fcd17908 100644 (file)
@@ -4,5 +4,6 @@
     <p style="margin-top: 80px"><img src="/img/404.png" alt="404"/></p>
     <hr/>
     <p>Application Version: {{AppVer}}</p>
+    <p>If you think it is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
 </div>
 {{template "base/footer" .}}
\ No newline at end of file