1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

SSL enable config option

This commit is contained in:
Unknown 2014-03-23 08:40:40 -04:00
parent 97e82a0ff6
commit 97debac185
12 changed files with 22 additions and 9 deletions

View File

@ -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.

View 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 协议支持
- 注册/删除用户
- 创建/删除/关注公开仓库
- 用户个人信息页面

View 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

View File

@ -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

View 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
}

View 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")

View 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())

View 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

View 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

View 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)
}

View 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>

View 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" .}}