a36f26e8e1
- pysimSendOta: Response Parser filled strictly from decoded PoR (por.decoded) for both SPI2 variants; envelope SW/failures no longer leak into it — they render in a new inline result line (#sp-send-result) next to Send to Card, always including SW on failure - Default-level stderr tracing per send (no flags needed): 'OTA SEND: SPI .. KIc .. KID .. TAR .. CNTR .. LEN ..B CHUNKS N', 'OTA SEND FAILED: chunk N SW xxxx' and 'OTA PoR[envelope|sms-submit]: status=.. TAR=.. CNTR=.. PCNTR=.. RPL=.. RHL=..' (+ compact summary / undecodable raw / none fallbacks) - _decode_por: surface every parsed PoR field verbatim (cntr, rpl, rhl, cc_rc, raw) instead of status/tar/pcntr only - genSp: CNTR normalization padEnd -> padStart so short input like '1' becomes 0000000001, not 1000000000 (counter is big-endian 5 bytes) - tests: TestDecodePor completeness + cntr_low field-report cases Version 1.9.3 -> 1.9.4 everywhere; SW cache otaman-v14 -> otaman-v15
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
const CACHE = 'otaman-v15';
|
|
const URLS = [
|
|
'index.html',
|
|
'help.html',
|
|
'help-ru.html',
|
|
'style.css',
|
|
'sim.png',
|
|
'favicon.svg',
|
|
'icon-192.png',
|
|
'icon-512.png',
|
|
'manifest.json',
|
|
'des-bundle.js',
|
|
'aes-bundle.js',
|
|
'sim.svg',
|
|
'sim_anim.svg',
|
|
'nosim.svg',
|
|
];
|
|
|
|
self.addEventListener('install', e => {
|
|
e.waitUntil(
|
|
caches.open(CACHE).then(c => c.addAll(URLS))
|
|
);
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', e => {
|
|
e.waitUntil(
|
|
caches.keys().then(keys =>
|
|
Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))
|
|
).then(() => clients.claim())
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', e => {
|
|
if (!e.request.url.startsWith('http')) return;
|
|
if (new URL(e.request.url).pathname.startsWith('/api/')) return; // live data, never cache
|
|
if (e.request.method !== 'GET') return;
|
|
const isNavigate = e.request.mode === 'navigate' || e.request.url.endsWith('sw.js');
|
|
if (isNavigate) {
|
|
e.respondWith(
|
|
fetch(e.request).then(res => {
|
|
const clone = res.clone();
|
|
caches.open(CACHE).then(c => c.put(e.request, clone));
|
|
return res;
|
|
}).catch(() => caches.match(e.request))
|
|
);
|
|
} else {
|
|
e.respondWith(
|
|
caches.match(e.request).then(r => r || fetch(e.request).then(res => {
|
|
const clone = res.clone();
|
|
caches.open(CACHE).then(c => c.put(e.request, clone));
|
|
return res;
|
|
}))
|
|
);
|
|
}
|
|
}); |