File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -605,7 +605,19 @@ function setupServiceWorkerUpdateListener() {
605605 if (!('serviceWorker' in navigator)) return;
606606
607607 // Load Version Info on startup
608- updateSystemVersionUI();
608+ updateSystemVersionUI().then(() => {
609+ // Daily Auto-Check Logic
610+ const lastCheck = parseInt(localStorage.getItem('last_sw_check') || '0');
611+ const ONE_DAY = 24 * 60 * 60 * 1000;
612+
613+ if (Date.now() - lastCheck > ONE_DAY) {
614+ console.log("[System] Running scheduled daily update check...");
615+ navigator.serviceWorker.getRegistration().then(reg => {
616+ if (reg) reg.update();
617+ localStorage.setItem('last_sw_check', Date.now().toString());
618+ });
619+ }
620+ });
609621
610622 const isUpdate = navigator.serviceWorker.controller !== null;
611623
@@ -622,10 +634,11 @@ function setupServiceWorkerUpdateListener() {
622634 }
623635
624636 const showUpdateNotification = () => {
625- showNotification(`Update available: Polygol`, {
626- icon: 'system_update',
637+ showNotification(`A new system update is ready to install. (Version ${newV})`, {
638+ header: 'System update',
639+ icon: 'update',
627640 system: true,
628- buttonText: 'Restart',
641+ buttonText: 'Restart and Install ',
629642 buttonAction: () => {
630643 worker.postMessage({ action: 'skipWaiting' });
631644 }
You can’t perform that action at this time.
0 commit comments