fix(avatar): add default cache max age for avatar response

pull/1532/head
HFO4 2 years ago
parent 4b85541d73
commit db6681f448

@ -76,6 +76,8 @@ type ThemeChose struct {
Theme string `json:"theme" binding:"required,hexcolor|rgb|rgba|hsl"`
}
const avatarMaxAge = 3600
// Update 更新主题设定
func (service *ThemeChose) Update(c *gin.Context, user *model.User) serializer.Response {
user.OptionsSerialized.PreferredTheme = service.Theme
@ -194,6 +196,8 @@ func (service *AvatarService) Get(c *gin.Context) serializer.Response {
"l": model.GetSettingByName("avatar_size_l"),
}
c.Header("Cache-Control", fmt.Sprintf("max-age=%d", avatarMaxAge))
// Gravatar 头像重定向
if user.Avatar == "gravatar" {
server := model.GetSettingByName("gravatar_server")

Loading…
Cancel
Save