Commit graph

6 commits

Author SHA1 Message Date
senke
45c130c856 feat(pwa): tighten sw.js to roadmap strategy spec + version stamper (W4 Day 16)
Some checks failed
Veza CI / Notify on failure (push) Blocked by required conditions
Veza CI / Rust (Stream Server) (push) Successful in 5m12s
Security Scan / Secret Scanning (gitleaks) (push) Failing after 48s
Veza CI / Backend (Go) (push) Failing after 8m51s
E2E Playwright / e2e (full) (push) Has been cancelled
Veza CI / Frontend (Web) (push) Has been cancelled
Service worker now applies the strategies the roadmap asks for :
  * Static assets : StaleWhileRevalidate (already in place)
  * HLS segments  : CacheFirst, max-age 7d, max 50 entries
  * API GET       : NetworkFirst, 3s timeout

Stayed on the hand-rolled fetch handlers rather than migrating to
Workbox — the existing implementation already covers push notifications
+ background sync + notificationclick, and Workbox would bring 200+ KB
of runtime + a build-step dependency for a feature set we already have.

Changes
- public/sw.js
  * HLS_CACHE_MAX_ENTRIES (50) + HLS_CACHE_MAX_AGE_MS (7d) +
    NETWORK_FIRST_TIMEOUT_MS (3s) tunable at the top of the file.
  * cacheAudio : reads the cached response's date header to skip
    stale entries (>7d), and prunes the cache FIFO after every put
    so the entry count never exceeds 50. Network-down path still
    serves stale entries (the offline-playback acceptance).
  * networkFirst : races the network against a 3s timer ; if the
    timer fires AND a cached entry exists, serve cached + let the
    network keep updating in the background. Timeout without a
    cached fallback lets the network race continue.
  * isAudioRequest now matches .ts and .m4s segments too (HLS).

- scripts/stamp-sw-version.mjs (new) : postbuild step that replaces
  the literal __BUILD_VERSION__ placeholder in dist/sw.js with
  YYYYMMDDHHMM-<short-sha>. Pre-Day 16 the placeholder shipped
  literally — same string across every deploy meant browser caches
  were never invalidated. Wired into npm run build + build:ci.

- tests/e2e/31-sw-offline-cache.spec.ts : 2 tests gated behind
  E2E_SW_TESTS=1 (SW only registers in prod builds — dev server
  skips registration via import.meta.env.DEV check). When enabled :
  (1) registration + activation, (2) cached resource served while
  context.setOffline(true).

Acceptance (Day 16) : strategies match spec ; offline playback works
once the user has played the segment once before going offline. The
e2e self-skips on dev unless E2E_SW_TESTS=1 is set against vite preview.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 09:43:09 +02:00
senke
66de8d6638 feat(v0.12.5): PWA enhancements — offline audio, responsive hooks, icons
- Service Worker: audio caching strategy for offline playback (cache-first)
- Service Worker: CACHE_AUDIO message for explicit track caching
- useMediaQuery hook with useIsMobile/useIsTablet/useIsDesktop helpers
- PWAUpdateBanner and OfflineBanner components (previously stubs)
- Missing notification icons: badge-72x72, checkmark, xmark

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 10:09:24 +01:00
senke
ec937f8956 feat(pwa): re-enable service worker with safe caching, add Install App in Settings 2026-02-25 09:56:26 +01:00
senke
0c8cd43303 feat(notifications): N1 Web Push subscribe, preferences, badge
- notificationService: subscribePush, getPreferences, updatePreferences
- PushPreferencesSection: API-connected toggles, subscribe button
- usePushSubscribe: permission, pushManager.subscribe, POST to API
- NotificationMenu: document.title badge (N1.4)
- sw.js: payload compat (link/url)
- MSW: push/subscribe, preferences handlers
2026-02-21 16:43:48 +01:00
senke
f0ba7de543 state-ownership: delete unused optimisticStoreUpdates.ts file
- Deleted apps/web/src/utils/optimisticStoreUpdates.ts (unused file)
- File was unused - no imports found in codebase
- Mutations already use React Query's onMutate pattern
- No TypeScript errors after deletion
- Actions 4.4.1.2 and 4.4.1.3 complete
2026-01-15 19:26:53 +01:00
okinrev
327ac36a30 BASE: completing the initial repo state 2025-12-03 22:56:50 +01:00