mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
use https for fetch gravatar by default (#20964)
This commit is contained in:
committed by
Arve Knudsen
parent
1a2dad9d0c
commit
5e34e061d5
@@ -27,19 +27,9 @@ import (
|
|||||||
gocache "github.com/patrickmn/go-cache"
|
gocache "github.com/patrickmn/go-cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
var gravatarSource string
|
const (
|
||||||
|
gravatarSource = "https://secure.gravatar.com/avatar/"
|
||||||
func UpdateGravatarSource() {
|
)
|
||||||
srcCfg := "//secure.gravatar.com/avatar/"
|
|
||||||
|
|
||||||
gravatarSource = srcCfg
|
|
||||||
if strings.HasPrefix(gravatarSource, "//") {
|
|
||||||
gravatarSource = "http:" + gravatarSource
|
|
||||||
} else if !strings.HasPrefix(gravatarSource, "http://") &&
|
|
||||||
!strings.HasPrefix(gravatarSource, "https://") {
|
|
||||||
gravatarSource = "http://" + gravatarSource
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avatar represents the avatar object.
|
// Avatar represents the avatar object.
|
||||||
type Avatar struct {
|
type Avatar struct {
|
||||||
@@ -126,8 +116,6 @@ func (this *CacheServer) Handler(ctx *macaron.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewCacheServer() *CacheServer {
|
func NewCacheServer() *CacheServer {
|
||||||
UpdateGravatarSource()
|
|
||||||
|
|
||||||
return &CacheServer{
|
return &CacheServer{
|
||||||
notFound: newNotFound(),
|
notFound: newNotFound(),
|
||||||
cache: gocache.New(time.Hour, time.Hour*2),
|
cache: gocache.New(time.Hour, time.Hour*2),
|
||||||
|
|||||||
Reference in New Issue
Block a user