Clear offline data on logout, test offline plan and recipe reads, drop Pillow
CI / ci (push) Successful in 1m35s
CI / ci (pull_request) Successful in 1m38s

- POST /auth/logout answers with Clear-Site-Data: "storage", "cache", which
  removes the verified-session marker, the service worker and its caches, so
  an offline visit after logout cannot reopen household data. The 401/403
  clearing path is unchanged.
- The service worker no longer answers network-only requests; it leaves them
  to the browser. Chrome stalls a Clear-Site-Data navigation that the worker
  answered, so the logout POST must bypass it.
- New tests send plan and recipe reads through the real API client and the
  real network-first strategy online, then serve them from the cache offline.
- The icon generator is now Go on golang.org/x/image (approved) instead of
  Python on Pillow; the icons are regenerated with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 09:36:45 -04:00
co-authored by Claude Opus 5.5
parent 7f8ae90978
commit 8f5ab773fc
15 changed files with 306 additions and 71 deletions
+5
View File
@@ -327,8 +327,13 @@ func (a *Auth) callback(w http.ResponseWriter, r *http.Request) {
// logout ends the session, clears the cookie and sends the browser to the
// provider's end_session_endpoint to end the provider session as well.
// Clear-Site-Data wipes this origin's storage and caches — the PWA's
// verified-session marker in localStorage and the service worker's cached API
// and media responses — so an offline visit after logout cannot reopen
// household data.
func (a *Auth) logout(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Clear-Site-Data", `"storage", "cache"`)
if err := a.sessions.EndSession(w, r); err != nil {
a.logger.ErrorContext(r.Context(), "end session", "error", err)
http.Error(w, "internal error", http.StatusInternalServerError)