0fd91d7771
Parser + BER constructor (TS 102 223 / TS 102 226): - DCS byte: genBerPcValue prepends DCS to 8D (00=GSM7, 08=UCS2, 04=unpacked) - decodeTextData: consume DCS first, legacy no-DCS fallback kept - BER_QUAL.display['80']: 'Clear after delay' -> 'Wait for user to clear message' - BER_QUAL.tone: 'Monotonous/Alternating' -> 'Vibrate alert' names - describeProactiveCommand: map type byte -> correct BER_QUAL key (01->refresh, 21->display, 20->tone); proper command names - parseActionRow: values 01-7F -> 'Reference to EFRMA record' - parseOneApdu: CLA 84-87 -> 'GlobalPlatform (secure messaging)' - PARSE_INS: added GET RESPONSE (INS C0) Version: 1.8.1 -> 1.9.0, SW cache otaman-v9 -> otaman-v10
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
const CACHE = 'otaman-v10';
|
|
const URLS = [
|
|
'index.html',
|
|
'help.html',
|
|
'help-ru.html',
|
|
'style.css',
|
|
'sim.png',
|
|
'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;
|
|
}))
|
|
);
|
|
}
|
|
}); |