fix(pwa): BUG-005 chargement mobile via Cloudflare (SW network-first + no-cache)
CI / lint (push) Successful in 58s
CI / security (push) Successful in 40s
CI / test (push) Successful in 1m19s
CI / build (push) Successful in 37s
CI / e2e (push) Successful in 10m53s
Desktop Build / build-windows (push) Canceled after 0s
Desktop Build / build-linux (push) Canceled after 0s

This commit is contained in:
2026-09-11 17:13:16 -04:00
parent 4c4e415975
commit 7cf7d33b6d
10 changed files with 382 additions and 153 deletions
+21 -2
View File
@@ -5067,8 +5067,27 @@ curl -X POST https://votre-serveur.com/webhook \
</div>
<script>
// Force-kill stale Service Worker and reload fresh
(function(){if('serviceWorker'in navigator&&navigator.serviceWorker.controller){var reloaded=sessionStorage.getItem('_sw_killed');if(!reloaded){navigator.serviceWorker.getRegistrations().then(function(regs){regs.forEach(function(r){r.unregister()})});caches.keys().then(function(names){names.forEach(function(n){caches.delete(n)})});sessionStorage.setItem('_sw_killed','1');location.reload(true)}}else{sessionStorage.removeItem('_sw_killed')}})();
// One-time migration for devices stuck on the legacy service worker
// (cache-first with a fixed cache name). Deletes the old caches and
// triggers an update check; the new network-first SW then takes over.
// Keyed in localStorage so it never loops or re-runs on every session.
(function () {
if (!('serviceWorker' in navigator) || !('caches' in window)) return;
var MIGRATION_KEY = 'obsigate-sw-migration';
try {
if (localStorage.getItem(MIGRATION_KEY) === 'v2') return;
localStorage.setItem(MIGRATION_KEY, 'v2');
} catch (e) { return; }
caches.keys().then(function (names) {
return Promise.all(names.map(function (name) {
return /^obsigate-(v1|offline-v1)$/.test(name) ? caches.delete(name) : null;
}));
}).then(function () {
return navigator.serviceWorker.getRegistration();
}).then(function (reg) {
if (reg) reg.update();
}).catch(function () { /* best effort */ });
})();
</script>
<script type="module" src="/static/js/app.js"></script>