aboutsummaryrefslogtreecommitdiffstats
path: root/build.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 07:21:12 -0700
committerAdam Soltys <[email protected]>2026-08-18 07:21:12 -0700
commit8c8e25a08348889fdfeeab62a910cc491e7760a2 (patch)
tree804e24278278e07aa976ac53d8b2b372e60ac194 /build.js
parent9a5292d31e13d290a2ccf72744ce6fa5dba26875 (diff)
downloadcoinosv3-8c8e25a08348889fdfeeab62a910cc491e7760a2.tar.gz
coinosv3-8c8e25a08348889fdfeeab62a910cc491e7760a2.zip
The service worker learns what must stay live: same-origin API paths — esplora, sp, lnurl, well-known — go straight to network, never the cache that froze a refresh on a stale unconfirmed
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'build.js')
-rw-r--r--build.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/build.js b/build.js
index 8abf5fb..0c8cba2 100644
--- a/build.js
+++ b/build.js
@@ -74,7 +74,13 @@ self.addEventListener('activate', (e) => {
self.addEventListener('fetch', (e) => {
const req = e.request;
if (req.method !== 'GET') return;
- if (new URL(req.url).origin !== self.location.origin) return; // explorer/ws → network
+ const u = new URL(req.url);
+ if (u.origin !== self.location.origin) return; // explorer/ws → network
+ // Live API paths served from OUR origin (esplora, sp indexer, lnurl,
+ // well-known) must never be cached: a chain answer frozen at first sight
+ // wedges every flow that polls it (a refresh once waited forever on a
+ // cached "unconfirmed"). Straight to network, always.
+ if (/^\\/(esplora|sp|lnurlp|electrum)\\//.test(u.pathname) || u.pathname.startsWith('/.well-known/')) return;
if (req.mode === 'navigate') {
e.respondWith(