Files
simtrace-analyser/frontend/sw.js
T
catarrh 824405f936 Files view: the PBR's SFI relations reach the APDU decode — and survive DF hops (v2.7.8)
- the PBR SFIs were learned only by the tracker; the message decode's
  per-channel SFI map still did not know them, so the SEARCH RECORD addressed
  by SFI 2 after the PBR read showed "SFI 2, unknown file" (the reported
  case: session 193, 5.434 s — the PBR read at 4.451 declared ADN 4F3A/SFI 2)
- database._advance_state now parses an EF_PBR record it sees (a READ
  RECORD's data or an UPDATE RECORD's body) and merges its FID+SFI pairs
  into the channel's SFI map, so SFI-addressed SEARCH/READ resolve without
  the file's own FCP
- the learned relations are cached per DF for the session: the live trace
  leaves DF_PHONEBOOK for DF_TELECOM (SELECT 7F10/6F06) and comes back, and
  the DF change used to rebuild the map from the static table only, dropping
  the PBR's pairs — the re-entry now merges the session cache
- verified on session 193: the SEARCH at 5.434 s (SFI 2) now resolves to
  4f3a (EF_ADN), as do the later ones (31.562/253.475/279.874 s)
- tests: the DB-level case — a PBR read, an excursion to DF_TELECOM and back,
  then an SFI-addressed SEARCH asserting the declared file; 538 Python +
  76 Node tests
- PWA_VERSION/pyproject/version.py 2.7.8, SW cache simtrace-analyser-v88
2026-10-18 01:26:47 +03:00

49 lines
1.4 KiB
JavaScript

const CACHE = 'simtrace-analyser-v88';
const PRECACHE = [
'index.html',
'manifest.json',
'icon-192.png',
'icon-512.png',
'favicon.png',
'sim-analyser.svg',
'sim-analyser-light.svg',
];
self.addEventListener('install', e => {
self.skipWaiting();
e.waitUntil(
caches.open(CACHE)
.then(cache => cache.addAll(PRECACHE))
.then(() => console.log('SW: precache done'))
.catch(err => console.error('SW: precache failed', err))
);
});
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys()
.then(keys => Promise.all(
keys.filter(k => k !== CACHE).map(k => caches.delete(k))
))
.then(() => self.clients.claim())
.then(() => console.log('SW: activated, controlling clients'))
);
});
self.addEventListener('fetch', e => {
// Network-first: the local server is always up, so always serve fresh
// content and fall back to cache only when offline.
if (!e.request.url.startsWith('http')) return;
if (e.request.method !== 'GET') return;
e.respondWith(
fetch(e.request)
.then(r => {
const clone = r.clone();
caches.open(CACHE).then(c => c.put(e.request, clone)).catch(() => {});
return r;
})
.catch(() => caches.match(e.request))
);
});