mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 09:34:05 +01:00
Add disable gravatar option
This commit is contained in:
parent
3bd5fc6d6f
commit
e7d8fadb08
5 changed files with 11 additions and 2 deletions
|
@ -166,6 +166,7 @@ SESSION_ID_HASHKEY =
|
||||||
[picture]
|
[picture]
|
||||||
; The place to picture data, either "server" or "qiniu", default is "server"
|
; The place to picture data, either "server" or "qiniu", default is "server"
|
||||||
SERVICE = server
|
SERVICE = server
|
||||||
|
DISABLE_GRAVATAR = false
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
||||||
|
|
|
@ -74,7 +74,9 @@ func (user *User) HomeLink() string {
|
||||||
|
|
||||||
// AvatarLink returns the user gravatar link.
|
// AvatarLink returns the user gravatar link.
|
||||||
func (user *User) AvatarLink() string {
|
func (user *User) AvatarLink() string {
|
||||||
if base.Service.EnableCacheAvatar {
|
if base.DisableGravatar {
|
||||||
|
return "/img/avatar_default.jpg"
|
||||||
|
} else if base.Service.EnableCacheAvatar {
|
||||||
return "/avatar/" + user.Avatar
|
return "/avatar/" + user.Avatar
|
||||||
}
|
}
|
||||||
return "//1.gravatar.com/avatar/" + user.Avatar
|
return "//1.gravatar.com/avatar/" + user.Avatar
|
||||||
|
|
|
@ -80,7 +80,8 @@ var (
|
||||||
SessionConfig *session.Config
|
SessionConfig *session.Config
|
||||||
SessionManager *session.Manager
|
SessionManager *session.Manager
|
||||||
|
|
||||||
PictureService string
|
PictureService string
|
||||||
|
DisableGravatar bool
|
||||||
|
|
||||||
EnableRedis bool
|
EnableRedis bool
|
||||||
EnableMemcache bool
|
EnableMemcache bool
|
||||||
|
@ -345,7 +346,9 @@ func NewConfigContext() {
|
||||||
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
|
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
|
||||||
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
|
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
|
||||||
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
|
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
|
||||||
|
|
||||||
PictureService = Cfg.MustValue("picture", "SERVICE")
|
PictureService = Cfg.MustValue("picture", "SERVICE")
|
||||||
|
DisableGravatar = Cfg.MustBool("picture", "DISABLE_GRAVATAR", false)
|
||||||
|
|
||||||
// Determine and create root git reposiroty path.
|
// Determine and create root git reposiroty path.
|
||||||
homeDir, err := com.HomeDir()
|
homeDir, err := com.HomeDir()
|
||||||
|
|
|
@ -169,6 +169,7 @@ func Config(ctx *middleware.Context) {
|
||||||
ctx.Data["SessionConfig"] = base.SessionConfig
|
ctx.Data["SessionConfig"] = base.SessionConfig
|
||||||
|
|
||||||
ctx.Data["PictureService"] = base.PictureService
|
ctx.Data["PictureService"] = base.PictureService
|
||||||
|
ctx.Data["DisableGravatar"] = base.DisableGravatar
|
||||||
|
|
||||||
ctx.Data["LogMode"] = base.LogMode
|
ctx.Data["LogMode"] = base.LogMode
|
||||||
ctx.Data["LogConfig"] = base.LogConfig
|
ctx.Data["LogConfig"] = base.LogConfig
|
||||||
|
|
|
@ -181,6 +181,8 @@
|
||||||
<dl class="dl-horizontal admin-dl-horizontal">
|
<dl class="dl-horizontal admin-dl-horizontal">
|
||||||
<dt>Picture Service</dt>
|
<dt>Picture Service</dt>
|
||||||
<dd>{{.PictureService}}</dd>
|
<dd>{{.PictureService}}</dd>
|
||||||
|
<dt>Disable Gravatar</dt>
|
||||||
|
<dd><i class="fa fa{{if .DisableGravatar}}-check{{end}}-square-o"></i></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue