Store cookie durations as max_age_seconds
Replace the free-form duration TEXT column with a nullable max_age_seconds INTEGER on both cookies and cookie_patterns tables. The SDK detector now sends raw seconds instead of humanized strings, eliminating locale-dependent comparisons in the pattern merge worker. Humanization happens at display time in the widget and console UI. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -187,9 +187,9 @@ func (h *Handler) handlePostConsent(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type detectedCookieEntry struct {
|
||||
Name string `json:"name"`
|
||||
Duration string `json:"duration"`
|
||||
Source string `json:"source"`
|
||||
Name string `json:"name"`
|
||||
MaxAgeSeconds *int `json:"max_age_seconds"`
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
type reportDetectedCookiesBody struct {
|
||||
@@ -239,9 +239,9 @@ func (h *Handler) handleReportDetectedCookies(w http.ResponseWriter, r *http.Req
|
||||
detected = append(
|
||||
detected,
|
||||
cookiebanner.DetectedCookie{
|
||||
Name: name,
|
||||
Duration: strings.TrimSpace(c.Duration),
|
||||
Source: source,
|
||||
Name: name,
|
||||
MaxAgeSeconds: c.MaxAgeSeconds,
|
||||
Source: source,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user