now it is PWA
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# OTAMan — APDU Helper & Secured Packet Builder
|
||||
# OTAMan — APDU Helper & Secured Packet Builder, SIM OTA in PWA
|
||||
|
||||
Standalone offline HTML/JS tool for building APDU commands for SIM, USIM, and GlobalPlatform RAM, assembling secure packets per ETSI TS 102 225, and constructing BER-TLV command scripts per ETSI TS 102 226.
|
||||
|
||||
@@ -371,6 +371,13 @@ Swaps nibble pairs of an even-length hex string.
|
||||
|
||||
---
|
||||
|
||||
## PWA
|
||||
|
||||
OTAMan is a Progressive Web App and can be installed for offline use. Use the **INSTALL PWA** button in the header, or use the browser's install prompt.
|
||||
|
||||
- Service worker pre-caches all assets on first visit
|
||||
- App icons at 192×192 and 512×512
|
||||
|
||||
## Theme
|
||||
|
||||
Dark theme is supported. The app follows the OS preference on first visit, and a manual toggle button (🌙/☀️) at the top-right corner persists the choice in `localStorage`.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
+25
-1
@@ -6,6 +6,9 @@
|
||||
<title>OTAMan</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="icon" type="image/png" href="sim.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<link rel="apple-touch-icon" href="icon-192.png">
|
||||
<script src="des-bundle.js"></script>
|
||||
</head>
|
||||
<body class="bg-neutral-50 dark:bg-slate-900 text-gray-800 dark:text-slate-200">
|
||||
@@ -14,7 +17,8 @@
|
||||
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-2xl font-bold text-heading">OTAMan</h1>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex items-center gap-4">
|
||||
<button id="install-btn" class="px-2 py-1 text-xs rounded border border-gray-300 dark:border-slate-600 hover:bg-gray-200 dark:hover:bg-slate-700" style="display:none">INSTALL PWA [for offline use]</button>
|
||||
<a href="https://github.com/anttro/otaman" target="_blank" class="text-xs text-gray-400 hover:text-gray-600 dark:text-slate-500 dark:hover:text-slate-300">github</a>
|
||||
<button onclick="toggleTheme()" id="theme-btn" class="px-2 py-1 text-sm rounded border border-gray-300 dark:border-slate-600 hover:bg-gray-200 dark:hover:bg-slate-700">🌙</button>
|
||||
</div>
|
||||
@@ -2369,6 +2373,26 @@ toggleSimOverride('usim');
|
||||
updateP1P2Display('sim');
|
||||
updateP1P2Display('usim');
|
||||
updateRamFields();
|
||||
// PWA
|
||||
let deferredPrompt;
|
||||
const installBtn = document.getElementById('install-btn');
|
||||
if (!window.matchMedia('(display-mode: standalone)').matches) {
|
||||
window.addEventListener('beforeinstallprompt', e => {
|
||||
e.preventDefault();
|
||||
deferredPrompt = e;
|
||||
installBtn.style.display = '';
|
||||
});
|
||||
installBtn.addEventListener('click', async () => {
|
||||
if (!deferredPrompt) return;
|
||||
deferredPrompt.prompt();
|
||||
const { outcome } = await deferredPrompt.userChoice;
|
||||
if (outcome === 'accepted') deferredPrompt = null;
|
||||
});
|
||||
window.addEventListener('appinstalled', () => { installBtn.style.display = 'none'; });
|
||||
}
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('sw.js');
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "OTAMan",
|
||||
"short_name": "OTAMan",
|
||||
"description": "Offline APDU helper for SIM/USIM/RAM commands",
|
||||
"start_url": "index.html",
|
||||
"display": "standalone",
|
||||
"background_color": "#fafafa",
|
||||
"theme_color": "#2563eb",
|
||||
"icons": [
|
||||
{ "src": "icon-192.png", "sizes": "192x192", "type": "image/png" },
|
||||
{ "src": "icon-512.png", "sizes": "512x512", "type": "image/png" }
|
||||
]
|
||||
}
|
||||
@@ -615,10 +615,6 @@ video {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.min-h-\[100px\] {
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.w-1\/3 {
|
||||
width: 33.333333%;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
const CACHE = 'otaman-v1';
|
||||
const URLS = [
|
||||
'index.html',
|
||||
'style.css',
|
||||
'sim.png',
|
||||
'icon-192.png',
|
||||
'icon-512.png',
|
||||
'manifest.json',
|
||||
'des-bundle.js',
|
||||
];
|
||||
|
||||
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)))
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', e => {
|
||||
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;
|
||||
}))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user