diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-11-16 20:27:04 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-11-16 20:27:04 -0500 |
commit | 340a4595ddc9e08f4c51f40496affb8fd3bb013d (patch) | |
tree | 2d1b899e001066a81a9b142884ae6d11895698f7 /modules | |
parent | 4c770b87c5aebc33b9fdd118b332732f995d63b2 (diff) | |
download | gitea-340a4595ddc9e08f4c51f40496affb8fd3bb013d.tar.gz gitea-340a4595ddc9e08f4c51f40496affb8fd3bb013d.zip |
support duoshuo mirror of gravatar
Diffstat (limited to 'modules')
-rw-r--r-- | modules/base/tool.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go index 50f073a525..0e083c8d0c 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -180,7 +180,7 @@ func AvatarLink(email string) string { } else if setting.Service.EnableCacheAvatar { return setting.AppSubUrl + "/avatar/" + EncodeMd5(email) } - return "//1.gravatar.com/avatar/" + EncodeMd5(email) + return setting.GravatarSource + EncodeMd5(email) } // Seconds-based time units diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 99116fff70..6b1b9fed4c 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -67,6 +67,7 @@ var ( // Picture settings. PictureService string + GravatarSource string DisableGravatar bool // Log settings. @@ -257,8 +258,13 @@ func NewConfigContext() { } ScriptType = Cfg.MustValue("repository", "SCRIPT_TYPE", "bash") - PictureService = Cfg.MustValueRange("picture", "SERVICE", "server", - []string{"server"}) + PictureService = Cfg.MustValueRange("picture", "SERVICE", "server", []string{"server"}) + switch Cfg.MustValue("picture", "GRAVATAR_SOURCE", "gravatar") { + case "duoshuo": + GravatarSource = "http://gravatar.duoshuo.com/avatar/" + default: + GravatarSource = "//1.gravatar.com/avatar/" + } DisableGravatar = Cfg.MustBool("picture", "DISABLE_GRAVATAR") MaxGitDiffLines = Cfg.MustInt("git", "MAX_GITDIFF_LINES", 10000) |