diff options
| author | Adam Soltys <[email protected]> | 2026-07-06 11:12:31 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-07-06 11:12:31 -0700 |
| commit | d071a09604599831d370b06563144cf4ba028902 (patch) | |
| tree | cf5974694de768a5128f044d255b399fa3eb18dd /build.js | |
| parent | ef1a901314cb667bc8a7c7ff5f080550edef2815 (diff) | |
| download | coinosv3-d071a09604599831d370b06563144cf4ba028902.tar.gz coinosv3-d071a09604599831d370b06563144cf4ba028902.zip | |
Gift cross-device sync, snapshot size cap, reliable SW updates, gift-detail layout
- Gifts now sync across devices: gift records + reserved/reclaimed coin
sets ride the encrypted snapshot as a merge-safe extension (like ark),
and every gift state change (create/reclaim/revoke) triggers a
saveCache so it actually publishes. A gift made on one device now
shows on the others.
- Cap the published snapshot at ~40KB JSON (relay rejects >64KB events,
nip44 expands ~1.5x): trim oldest on-chain txs when oversized; another
device backfills via rescan. Typical wallets untouched.
- Service worker: register with updateViaCache:'none' so a new build is
detected immediately (not held by the 4h HTTP cache), and reload once
on controllerchange so the fresh app runs without a manual second
refresh.
- Gift detail: View/Reclaim share a row, Revoke on its own full-width
line so 'Revoke now' stops wrapping.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'build.js')
| -rw-r--r-- | build.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -104,8 +104,15 @@ const PWA_HEAD = `<link rel="manifest" href="manifest.webmanifest"> <link rel="apple-touch-icon" href="icon-192.png"> `; +// Register with updateViaCache:'none' so the browser always re-fetches sw.js +// (never from HTTP cache) and detects a new build immediately. When the new SW +// takes control (it skipWaiting + clients.claim), reload once so the fresh +// inlined app runs — but only if a SW was already controlling this page, so a +// first-ever visit doesn't reload. const SW_REGISTER = - `<script>if('serviceWorker'in navigator)addEventListener('load',function(){navigator.serviceWorker.register('sw.js').catch(function(){})});</script>`; + `<script>if('serviceWorker'in navigator){var _had=!!navigator.serviceWorker.controller,_ref=false;` + + `navigator.serviceWorker.addEventListener('controllerchange',function(){if(_had&&!_ref){_ref=true;location.reload()}});` + + `addEventListener('load',function(){navigator.serviceWorker.register('sw.js',{updateViaCache:'none'}).catch(function(){})})}</script>`; // Bundle the standalone jsQR decoder (sets window.jsQR) for lazy loading. export async function buildJsQr({ minify = true } = {}) { |
