summaryrefslogtreecommitdiffstats
path: root/modules/base
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-27 01:05:13 -0600
committerUnknown <joe2010xtmf@163.com>2014-04-27 01:05:13 -0600
commit62d23e91541550d0478c4884696e918a0e818b4f (patch)
tree335e18b41b15a419233e5117d1cbc43fa66f2b5c /modules/base
parent59d0e73c3507296b31c8e741b44afc7bfe1eb695 (diff)
downloadgitea-62d23e91541550d0478c4884696e918a0e818b4f.tar.gz
gitea-62d23e91541550d0478c4884696e918a0e818b4f.zip
HTTP no follow and offline mode
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/conf.go18
-rw-r--r--modules/base/template.go10
2 files changed, 15 insertions, 13 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 17b55316a8..cfc85ff51e 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -45,14 +45,15 @@ type Oauther struct {
}
var (
- AppVer string
- AppName string
- AppLogo string
- AppUrl string
- IsProdMode bool
- Domain string
- SecretKey string
- RunUser string
+ AppVer string
+ AppName string
+ AppLogo string
+ AppUrl string
+ OfflineMode bool
+ ProdMode bool
+ Domain string
+ SecretKey string
+ RunUser string
RepoRootPath string
ScriptType string
@@ -325,6 +326,7 @@ func NewConfigContext() {
AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png")
AppUrl = Cfg.MustValue("server", "ROOT_URL")
Domain = Cfg.MustValue("server", "DOMAIN")
+ OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE", false)
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false)
diff --git a/modules/base/template.go b/modules/base/template.go
index 79aeeb9d77..dd98df75b1 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -56,8 +56,8 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppDomain": func() string {
return Domain
},
- "IsProdMode": func() bool {
- return IsProdMode
+ "CdnMode": func() bool {
+ return ProdMode && !OfflineMode
},
"LoadTimes": func(startTime time.Time) string {
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
@@ -124,11 +124,11 @@ func ActionIcon(opType int) string {
const (
TPL_CREATE_REPO = `<a href="/user/%s">%s</a> created repository <a href="/%s">%s</a>`
TPL_COMMIT_REPO = `<a href="/user/%s">%s</a> pushed to <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>%s`
- TPL_COMMIT_REPO_LI = `<div><img src="%s?s=16" alt="user-avatar"/> <a href="/%s/commit/%s">%s</a> %s</div>`
+ TPL_COMMIT_REPO_LI = `<div><img src="%s?s=16" alt="user-avatar"/> <a href="/%s/commit/%s" rel="nofollow">%s</a> %s</div>`
TPL_CREATE_ISSUE = `<a href="/user/%s">%s</a> opened issue <a href="/%s/issues/%s">%s#%s</a>
<div><img src="%s?s=16" alt="user-avatar"/> %s</div>`
TPL_TRANSFER_REPO = `<a href="/user/%s">%s</a> transfered repository <code>%s</code> to <a href="/%s">%s</a>`
- TPL_PUSH_TAG = `<a href="/user/%s">%s</a> pushed tag <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>`
+ TPL_PUSH_TAG = `<a href="/user/%s">%s</a> pushed tag <a href="/%s/src/%s" rel="nofollow">%s</a> at <a href="/%s">%s</a>`
)
type PushCommit struct {
@@ -165,7 +165,7 @@ func ActionDesc(act Actioner) string {
buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, AvatarLink(commit.AuthorEmail), repoLink, commit.Sha1, commit.Sha1[:7], commit.Message) + "\n")
}
if push.Len > 3 {
- buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len))
+ buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s" rel="nofollow">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len))
}
return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink,
buf.String())