|
|
|
@ -27,19 +27,9 @@ import ( |
|
|
|
|
gocache "github.com/patrickmn/go-cache" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var gravatarSource string |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const ( |
|
|
|
|
gravatarSource = "https://secure.gravatar.com/avatar/" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Avatar represents the avatar object.
|
|
|
|
|
type Avatar struct { |
|
|
|
@ -126,8 +116,6 @@ func (this *CacheServer) Handler(ctx *macaron.Context) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func NewCacheServer() *CacheServer { |
|
|
|
|
UpdateGravatarSource() |
|
|
|
|
|
|
|
|
|
return &CacheServer{ |
|
|
|
|
notFound: newNotFound(), |
|
|
|
|
cache: gocache.New(time.Hour, time.Hour*2), |
|
|
|
|