]> source.dussan.org Git - gitea.git/commitdiff
Fix #67
authorUnknown <joe2010xtmf@163.com>
Tue, 8 Apr 2014 16:41:33 +0000 (12:41 -0400)
committerUnknown <joe2010xtmf@163.com>
Tue, 8 Apr 2014 16:41:33 +0000 (12:41 -0400)
README.md
README_ZH.md
gogs.go
models/repo.go
modules/base/conf.go
modules/base/template.go
routers/install.go
serve.go
templates/base/head.tmpl

index fe15328b1b8774f2c8dedbce9e535d1c6f1d8609..a4e8901c5db1bc359fd111d614ed38d1c60bb64e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
 ## Features
 
 - Activity timeline
-- SSH/HTTPS(Clone only) protocol support.
+- SSH/HTTP(S) protocol support.
 - Register/delete/rename account.
 - Create/delete/watch/rename/transfer public repository.
 - Repository viewer.
index 015ee0af995735603f0686602e643729f210cf06..2f80154102738a549e89b17cb4100e020ad5e983 100644 (file)
@@ -23,7 +23,7 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
 ## 功能特性
 
 - 活动时间线
-- SSH/HTTPS(仅限 Clone) 协议支持
+- SSH/HTTP(S) 协议支持
 - 注册/删除/重命名用户
 - 创建/删除/关注/重命名/转移公开仓库
 - 仓库浏览器
diff --git a/gogs.go b/gogs.go
index df268980f5508b06fc1535440c959b27e7499dd6..4616141e3d11d2f040d4d1c80eb94daf6be7f6a8 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -19,7 +19,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.2.2.0407 Alpha"
+const APP_VER = "0.2.2.0408 Alpha"
 
 func init() {
        base.AppVer = APP_VER
index bb5c36372ef2698a35e38ee272802f57c8d5a618..4f58f407faf6caf714afe2cf2f40fc47d42fbb53 100644 (file)
@@ -261,6 +261,13 @@ func createHookUpdate(hookPath, content string) error {
        return err
 }
 
+// SetRepoEnvs sets environment variables for command update.
+func SetRepoEnvs(userId int64, userName, repoName string) {
+       os.Setenv("userId", base.ToStr(userId))
+       os.Setenv("userName", userName)
+       os.Setenv("repoName", repoName)
+}
+
 // InitRepository initializes README and .gitignore if needed.
 func initRepository(f string, user *User, repo *Repository, initReadme bool, repoLang, license string) error {
        repoPath := RepoPath(user.Name, repo.Name)
@@ -333,10 +340,7 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
                return nil
        }
 
-       // for update use
-       os.Setenv("userName", user.Name)
-       os.Setenv("userId", base.ToStr(user.Id))
-       os.Setenv("repoName", repo.Name)
+       SetRepoEnvs(user.Id, user.Name, repo.Name)
 
        // Apply changes and commit.
        return initRepoCommit(tmpDir, user.NewGitSig())
index 69df49dc48394dee08d3e6a802e712313a84af67..871595e4765616a7dc6f82217c002121da8dd59e 100644 (file)
@@ -43,6 +43,7 @@ var (
        AppName      string
        AppLogo      string
        AppUrl       string
+       IsProdMode   bool
        Domain       string
        SecretKey    string
        RunUser      string
index 6cd8ade6110324429105efc8d2fc1d3e2c8fcec0..5a42107c451517af2cd3a1ec72a89f399e85012a 100644 (file)
@@ -56,6 +56,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
        "AppDomain": func() string {
                return Domain
        },
+       "IsProdMode": func() bool {
+               return IsProdMode
+       },
        "LoadTimes": func(startTime time.Time) string {
                return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
        },
index 1c4e6181d50ba7aa307e57657ab1667a609d2b68..b9e8bb290784e6cfadb11c1da7edb9773fda7742 100644 (file)
@@ -27,6 +27,7 @@ func checkRunMode() {
        switch base.Cfg.MustValue("", "RUN_MODE") {
        case "prod":
                martini.Env = martini.Prod
+               base.IsProdMode = true
        case "test":
                martini.Env = martini.Test
        }
index 7e00db4734009eca0352929fbdb9d6929c2316b0..3843da617e0cc02c00a83e5308d3a9aa3a96ec81 100644 (file)
--- a/serve.go
+++ b/serve.go
@@ -177,10 +177,7 @@ func runServ(k *cli.Context) {
                qlog.Fatal("Unknown command")
        }
 
-       // for update use
-       os.Setenv("userName", user.Name)
-       os.Setenv("userId", strconv.Itoa(int(user.Id)))
-       os.Setenv("repoName", repoName)
+       models.SetRepoEnvs(user.Id, user.Name, repoName)
 
        gitcmd := exec.Command(verb, repoPath)
        gitcmd.Dir = base.RepoRootPath
index 7f56ed7080664690c8cbac6f9c98a6b904b33144..2f88e918f31137ef971036f4a763218924135c48 100644 (file)
                <meta name="_csrf" content="{{.CsrfToken}}" />
 
                 <!-- Stylesheets -->
+               {{if IsProdMode}}
+               <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
+               <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+
+               <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
+               <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
+               {{else}}
                <link href="/css/bootstrap.min.css" rel="stylesheet" />
-               <link href="/css/todc-bootstrap.min.css" rel="stylesheet" />
                <link href="/css/font-awesome.min.css" rel="stylesheet" />
-               <link href="/css/markdown.css" rel="stylesheet" />
-               <link href="/css/gogs.css" rel="stylesheet" />
 
                <script src="/js/jquery-1.10.1.min.js"></script>
                <script src="/js/bootstrap.min.js"></script>
+               {{end}}
+
+               <link href="/css/todc-bootstrap.min.css" rel="stylesheet" />
+               <link href="/css/markdown.css" rel="stylesheet" />
+               <link href="/css/gogs.css" rel="stylesheet" />
+
         <script src="/js/lib.js"></script>
         <script src="/js/app.js"></script>
                <title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>