Rollback alla 3.0.0 (24391c4)

Ripristinato per intero lo stato del commit 24391c4, che sull'iPhone
con l'icona installata si vedeva correttamente. Le modifiche dei commit
successivi restano nella storia per essere riprese una per volta.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
alexspeakerandClaude Fable 5.1 committed 2026-11-06 16:08:48 +01:00
1 parent c9fecb068b
commit ffb04a96a7
8 files changed
+12 -188

No files matched your search

+2 -30
View File
@@ -758,7 +758,7 @@
'<button type="button" class="btn btn-accent btn-lg offline-btn" id="offlineRetryBtn">' +
'<svg class="icon" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>' +
'<span>Riprova</span></button></div>';
(document.getElementById('app') || body).appendChild(overlay);
body.appendChild(overlay);
var btn = $('#offlineRetryBtn');
btn.addEventListener('click', function () {
@@ -786,36 +786,8 @@
Avvio
===================================================================== */
/**
* Guscio vecchio con script nuovo (un service worker di una versione precedente ha servito l'HTML dalla cache):
* si svuotano cache e worker e si ricarica, una volta sola.
*/
function gusciVecchio() {
if (document.getElementById('player-dock')) return false;
var chiave = 'rpi-riparazione';
try {
if (sessionStorage.getItem(chiave)) return true;
sessionStorage.setItem(chiave, '1');
} catch (e) { /* senza archivio si tenta comunque una volta */ }
var pulizia = [];
if ('serviceWorker' in navigator) {
pulizia.push(navigator.serviceWorker.getRegistrations().then(function (regs) {
return Promise.all(regs.map(function (r) { return r.unregister(); }));
}));
}
if ('caches' in window) {
pulizia.push(caches.keys().then(function (keys) {
return Promise.all(keys.map(function (k) { return caches.delete(k); }));
}));
}
Promise.all(pulizia).catch(function () { /* si ricarica comunque */ }).then(function () {
window.location.reload();
});
return true;
}
function init() {
if (!content || gusciVecchio()) return;
if (!content) return;
Offline.init();
Player.init();
Podcast.init();
+1 -16
View File
@@ -12,26 +12,11 @@
var BASE = window.BASE_PATH || '';
if ('serviceWorker' in navigator) {
// C'era già un worker a governare la pagina? Allora un cambio di worker è un aggiornamento dell'app
var avevaWorker = !!navigator.serviceWorker.controller;
var ricaricando = false;
window.addEventListener('load', function () {
navigator.serviceWorker.register(BASE + '/sw.js', { updateViaCache: 'none' }).then(function (reg) {
// Controllo esplicito a ogni apertura: il browser da solo lo fa al massimo ogni 24 ore
reg.update().catch(function () { /* offline: si riprova alla prossima apertura */ });
}).catch(function (error) {
navigator.serviceWorker.register(BASE + '/sw.js').catch(function (error) {
console.error('[PWA] Registrazione Service Worker fallita:', error);
});
});
// Il worker nuovo ha preso il controllo (skipWaiting + clients.claim): si ricarica una volta,
// così guscio e script sono della stessa versione
navigator.serviceWorker.addEventListener('controllerchange', function () {
if (!avevaWorker || ricaricando) return;
ricaricando = true;
window.location.reload();
});
}
var isStandalone = window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true;