Fix conflict between test mode and actual update status
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
2705989ff6
commit
d2d2ea976b
@ -312,6 +312,15 @@ function initSystemStatus() {
|
|||||||
return;
|
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
|
// Show loading state on both update buttons
|
||||||
// Original button
|
// Original button
|
||||||
if (updateButton) {
|
if (updateButton) {
|
||||||
@ -544,8 +553,19 @@ function initSystemStatus() {
|
|||||||
console.log('Manual refresh result:', data);
|
console.log('Manual refresh result:', data);
|
||||||
|
|
||||||
if (data.status === 'success') {
|
if (data.status === 'success') {
|
||||||
// Show notification about current status
|
// Check if we're in test mode
|
||||||
if (data.data && data.data.updateAvailable) {
|
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);
|
showUpdateAlert(data.data.currentVersion, data.data.remoteVersion);
|
||||||
showNotification(`Update is available: ${data.data.currentVersion} → ${data.data.remoteVersion}`, 'info');
|
showNotification(`Update is available: ${data.data.currentVersion} → ${data.data.remoteVersion}`, 'info');
|
||||||
} else {
|
} else {
|
||||||
@ -588,8 +608,26 @@ function initSystemStatus() {
|
|||||||
if (newSetting) {
|
if (newSetting) {
|
||||||
// If enabling test mode, force show update button
|
// If enabling test mode, force show update button
|
||||||
showUpdateAlert('2.0.10', '2.1.0-test');
|
showUpdateAlert('2.0.10', '2.1.0-test');
|
||||||
updateStatusElement.innerHTML = '<i class="fas fa-exclamation-circle text-warning"></i> Update available';
|
updateStatusElement.innerHTML = '<i class="fas fa-exclamation-circle text-warning"></i> Update available (TEST MODE)';
|
||||||
showNotification('Test update button enabled', 'info');
|
|
||||||
|
// 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 {
|
} else {
|
||||||
// If disabling test mode, check for real updates
|
// If disabling test mode, check for real updates
|
||||||
hideUpdateAlert();
|
hideUpdateAlert();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user