Files
simple/frontend/sw.js
T
catarrh 052d90c03e ui: HTTP OTA pill labels, CAT_TP paired with the BIP opening (v3.5.0)
- The first two Push commands sub-pills carry the HTTP OTA prefix
  ("HTTP OTA Trigger (Push SMS)", "HTTP OTA Store (SD admin params)"), so the
  form headings drop it and read "Administrative session trigger (Push SMS)"
  / "Administrative session store data (SD admin params)".
- BIP channel opening (01) gains the same-message CAT_TP follow-up: an "Also
  request the CAT_TP link establishment (02) in the same message" checkbox
  with the shared CAT_TP fields (destination port mandatory, optional max SDU
  / identification data / extra TLVs).  The preview and Pack then carry the
  pair 80EC0101...80EC0102... as one command script (concatenated SMS when
  over 140 octets) and -> Expanded Script appends both 22 Command TLVs.
  Rationale (SIMalliance Stepping Stones R7 18.6): 01 carries the channel
  parameters, 02 only the CAT_TP port, and the guide recommends both in the
  same SMS; standalone 02 stays for cards with provisioned defaults.
- Help 2.7 EN/RU, READMEs and AGENTS document the pairing, the fact that 03 is
  self-contained (it carries the mandatory OPEN CHANNEL TCP set, so no
  companion 01) and the Stepping Stones PoR advice (no PoR on success; on
  failure use SMS-SUBMIT / SPI2 0x20).
- pushSectionApdus vectors cover the 01+02 pair and its mandatory port;
  sw cache -> simple-v250.
2026-09-23 22:39:13 +03:00

71 lines
1.8 KiB
JavaScript

const CACHE = 'simple-v250';
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',
'uicc_files.json',
];
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())
);
});
const OFFLINE_RESPONSE = new Response('Offline: page not cached', {
status: 503,
statusText: 'Offline',
headers: { 'Content-Type': 'text/plain' },
});
self.addEventListener('fetch', e => {
if (!e.request.url.startsWith('http')) return;
const path = new URL(e.request.url).pathname;
if (path.startsWith('/api/')) return; // live data, never cache
if (e.request.method !== 'GET') return;
const isNavigate = e.request.mode === 'navigate';
const isSwScript = path.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)
.then(r => r || caches.match('index.html'))
.then(r => r || OFFLINE_RESPONSE)
)
);
} else if (isSwScript) {
e.respondWith(fetch(e.request).catch(() => OFFLINE_RESPONSE));
} 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;
}))
);
}
});