Fix Update notification.

This commit is contained in:
gerlofvanek
2025-10-21 08:21:55 +02:00
parent 15b2030b92
commit 95da26211b
3 changed files with 60 additions and 0 deletions

View File

@@ -321,6 +321,7 @@ function ensureToastContainer() {
updateHistoryDropdown();
this.initializeBalanceTracking();
this.checkForPendingUpdateNotification();
if (window.CleanupManager) {
window.CleanupManager.registerResource('notificationManager', this, (mgr) => {
@@ -331,6 +332,29 @@ function ensureToastContainer() {
return this;
},
checkForPendingUpdateNotification: function() {
CleanupManager.setTimeout(async () => {
try {
const response = await fetch('/json/updatestatus');
const updateStatus = await response.json();
if (updateStatus.update_available && config.showUpdateNotifications) {
this.createToast(
`Update Available: v${updateStatus.latest_version}`,
'update_available',
{
subtitle: `Current: v${updateStatus.current_version} • Click to view release`,
releaseUrl: updateStatus.release_url,
releaseNotes: updateStatus.release_notes
}
);
}
} catch (error) {
console.error('Error checking for pending update notification:', error);
}
}, 2000);
},
updateSettings: function(newSettings) {
saveConfig(newSettings);
return this;