From d2d2ea976b6a4e6354f88f6d783fe0804b6283ce Mon Sep 17 00:00:00 2001 From: MasterDraco Date: Mon, 10 Mar 2025 18:36:58 +0000 Subject: [PATCH] Fix conflict between test mode and actual update status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added automatic test mode disabling when update attempt is made - Added clear test mode indicator in the floating notification - Implemented automatic test mode disabling when real update check shows no update - Added visual distinction between test and real update notifications - Added warning message for test mode to prevent confusion - Updated update status text to clearly indicate when in test mode - Fixed potential conflict in test toggle handler - Improved usability with clearer notification messages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- public/js/system-status.js | 46 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/public/js/system-status.js b/public/js/system-status.js index 3487561..d80b46e 100644 --- a/public/js/system-status.js +++ b/public/js/system-status.js @@ -312,6 +312,15 @@ function initSystemStatus() { return; } + // Disable test mode whenever we try to apply an update + localStorage.setItem('showUpdateButton', 'false'); + + // Update toggle button text if it exists + const testToggle = document.getElementById('toggle-test-update-button'); + if (testToggle) { + testToggle.innerText = 'Enable Test Update'; + } + // Show loading state on both update buttons // Original button if (updateButton) { @@ -544,8 +553,19 @@ function initSystemStatus() { console.log('Manual refresh result:', data); if (data.status === 'success') { - // Show notification about current status - if (data.data && data.data.updateAvailable) { + // Check if we're in test mode + const isTestMode = localStorage.getItem('showUpdateButton') === 'true'; + + // If test mode is enabled but update says no update available, disable test mode + if (isTestMode && data.data && !data.data.updateAvailable) { + localStorage.setItem('showUpdateButton', 'false'); + testToggle.innerText = 'Enable Test Update'; + showNotification('Test mode has been disabled - no real update is available', 'info'); + hideUpdateAlert(); + showNotification(`Current version: ${data.data.currentVersion}. You are up to date.`, 'success'); + } + // Regular update handling + else if (data.data && data.data.updateAvailable) { showUpdateAlert(data.data.currentVersion, data.data.remoteVersion); showNotification(`Update is available: ${data.data.currentVersion} → ${data.data.remoteVersion}`, 'info'); } else { @@ -588,8 +608,26 @@ function initSystemStatus() { if (newSetting) { // If enabling test mode, force show update button showUpdateAlert('2.0.10', '2.1.0-test'); - updateStatusElement.innerHTML = ' Update available'; - showNotification('Test update button enabled', 'info'); + updateStatusElement.innerHTML = ' Update available (TEST MODE)'; + + // Add test mode indicator to floating notification + const floatingNotification = document.getElementById('floating-update-notification'); + if (floatingNotification) { + const testBadge = document.createElement('div'); + testBadge.style.backgroundColor = 'orange'; + testBadge.style.color = 'black'; + testBadge.style.padding = '3px 8px'; + testBadge.style.borderRadius = '4px'; + testBadge.style.fontWeight = 'bold'; + testBadge.style.marginBottom = '5px'; + testBadge.style.fontSize = '12px'; + testBadge.textContent = 'TEST MODE - NOT A REAL UPDATE'; + + // Insert at the top of the notification + floatingNotification.insertBefore(testBadge, floatingNotification.firstChild); + } + + showNotification('TEST MODE ENABLED - This is not a real update', 'warning'); } else { // If disabling test mode, check for real updates hideUpdateAlert();