072e8fe08b
SIM/USIM encoder (registry §2.3): - New PIN commands: DISABLE '26' / ENABLE '28' (single FF-padded PIN, Lc=08) and UNBLOCK '2C' (unblock+new, Lc=10); dynamic field labels - ACTIVATE/DEACTIVATE FILE target selection: Current EF (case 1), by FID (P1=00), path from MF (P1=08), path from current DF (P1=09) with Lc+FID/path data form - LANG_RU entries for new labels Tests: - sim.test.js: new stub-DOM genSimUsim harness; exact-hex for all PIN ops, ACTIVATE/DEACTIVATE forms, SELECT Le rules, RECORD P1=00 rule - response_map.test.js: lookupSw wildcards (91XX / 63CX), LIFECYCLE_MAP per GPC v2.3, PRIVILEGE_NAMES vs Tables 11-7/11-8/11-9 GET STATUS E3 template decoding verified already present (TLV_TAG_NAMES + decodeTlvValue cover 4F/9F70/C5/CF/C4/CC/CE/84). Version 1.9.1 -> 1.9.2, SW cache otaman-v12 -> otaman-v13
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
const CACHE = 'otaman-v13';
|
|
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;
|
|
}))
|
|
);
|
|
}
|
|
}); |