mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-02-12 00:39:29 -06:00
Skip caching user stats on CDN level
The problem is that url does not have user id in it (we still cache inside)
This commit is contained in:
@@ -686,11 +686,6 @@ func (s *Server) getAccountStats(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
timeFrom := time.Now().UTC().AddDate(-1 /*years*/, 0 /*months*/, 0 /*days*/).Truncate(24 * time.Hour)
|
||||
etag := common.GenerateETag(strconv.Itoa(int(user.ID)), timeFrom.Format(time.RFC3339))
|
||||
if etagHeader := r.Header.Get(common.HeaderIfNoneMatch); len(etagHeader) > 0 && (etagHeader == etag) {
|
||||
w.WriteHeader(http.StatusNotModified)
|
||||
return
|
||||
}
|
||||
|
||||
type point struct {
|
||||
Date int64 `json:"x"`
|
||||
@@ -722,12 +717,7 @@ func (s *Server) getAccountStats(w http.ResponseWriter, r *http.Request) {
|
||||
Data: data,
|
||||
}
|
||||
|
||||
cacheHeaders := map[string][]string{
|
||||
common.HeaderETag: []string{etag},
|
||||
common.HeaderCacheControl: common.PrivateCacheControl1m,
|
||||
}
|
||||
|
||||
common.SendJSONResponse(ctx, w, response, cacheHeaders)
|
||||
common.SendJSONResponse(ctx, w, response, common.NoCacheHeaders)
|
||||
}
|
||||
|
||||
func (s *Server) createUsageSettingsModel(ctx context.Context, user *dbgen.User) *settingsUsageRenderContext {
|
||||
|
||||
Reference in New Issue
Block a user