projects

2026liveprivate repo

Life counter

TCG Life Counter: an offline-first PWA for Magic and more

Magic (Standard and Commander) for 2 to 6 players, with a commander damage matrix, undo, Wake Lock and an AMOLED theme. Installable, works with no network.

Adding a new game is one entry in a registry, not a code branch: the format declares starting life, its own counters and the table layout, and the interface derives from that. Which is why Pokémon or Lorcana slot in without touching the views.

The most instructive bug was a service worker one. Fixing the CSP reached nobody who already had the app open: the SW precaches `index.html` with the headers it was downloaded with, and since headers are not part of the bundle, no hash changed, `sw.js` stayed byte-for-byte identical, and the browser saw no update. The fix was to stamp a hash of the headers into the HTML as a `<meta>` at build time, so changing the policy changes the document and with it the precache revision.