Fix dynamic version display and update button issues

- Updated footer version to dynamically display current running version
- Fixed update button disappearing when refreshing status
- Added version tracking to prevent update button from hiding
- Updated About modal to show current version and added v2.0.10 to version history
- Fixed error handling in update check process

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-10 17:28:50 +00:00
parent c0a7362226
commit 3ff0a50553
2 changed files with 53 additions and 3 deletions

View File

@@ -22,9 +22,22 @@ function initSystemStatus() {
.then(handleResponse)
.then(data => {
if (data.status === 'success') {
// Update version display
versionElement.textContent = data.data.version;
uptimeElement.textContent = data.data.uptime;
// Also update footer version
const footerVersion = document.getElementById('footer-version');
if (footerVersion) {
footerVersion.textContent = 'v' + data.data.version;
}
// Update version in about modal too if it exists
const aboutVersionElement = document.querySelector('.text-center.mt-4 strong');
if (aboutVersionElement && aboutVersionElement.textContent.includes('Transmission RSS Manager v')) {
aboutVersionElement.textContent = 'Transmission RSS Manager v' + data.data.version;
}
// Update transmission status with icon
if (data.data.transmissionStatus === 'Connected') {
transmissionStatusElement.innerHTML = '<i class="fas fa-check-circle text-success"></i> Connected';
@@ -41,10 +54,19 @@ function initSystemStatus() {
});
}
// Track update check status
let updateAvailable = false;
let updateCheckInProgress = false;
// Check for updates
function checkForUpdates() {
// Don't hide update button if an update is available and we're just refreshing
if (!updateAvailable) {
updateAvailableDiv.classList.add('d-none');
}
updateStatusElement.innerHTML = '<i class="fas fa-circle-notch fa-spin"></i> Checking...';
updateAvailableDiv.classList.add('d-none');
updateCheckInProgress = true;
// Add test=true parameter to force update availability for testing
const testMode = localStorage.getItem('showUpdateButton') === 'true';
@@ -53,6 +75,7 @@ function initSystemStatus() {
// Set a timeout to detect network issues
const timeoutId = setTimeout(() => {
updateStatusElement.innerHTML = '<i class="fas fa-times-circle text-danger"></i> Check timed out';
updateCheckInProgress = false;
showNotification('Update check timed out. Please try again later.', 'warning');
}, 10000); // 10 second timeout
@@ -77,22 +100,29 @@ function initSystemStatus() {
return response.json();
})
.then(data => {
updateCheckInProgress = false;
clearTimeout(timeoutId);
if (data.status === 'success') {
if (data.data && data.data.updateAvailable) {
updateAvailable = true;
updateStatusElement.innerHTML = '<i class="fas fa-exclamation-circle text-warning"></i> Update available';
updateAvailableDiv.classList.remove('d-none');
updateAvailableDiv.querySelector('span').textContent =
`A new version is available: ${data.data.currentVersion}${data.data.remoteVersion}`;
} else {
updateAvailable = false;
updateStatusElement.innerHTML = '<i class="fas fa-check-circle text-success"></i> Up to date';
}
} else {
// Error status but with a response
updateAvailable = false;
updateStatusElement.innerHTML = '<i class="fas fa-times-circle text-danger"></i> Check failed';
showNotification(data.message || 'Failed to check for updates', 'danger');
}
})
.catch(error => {
updateCheckInProgress = false;
clearTimeout(timeoutId);
console.error('Error checking for updates:', error);
updateStatusElement.innerHTML = '<i class="fas fa-times-circle text-danger"></i> Check failed';