removed spamy updateFileBrowserStatus

This commit is contained in:
Madiator2011 2024-11-13 13:43:14 +01:00 committed by GitHub
parent 7b3a885f66
commit 6a30c77e82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3498,7 +3498,7 @@
//loadHFToken(); // lutzapps - added HF_TOKEN Support //loadHFToken(); // lutzapps - added HF_TOKEN Support
} else if (tabName === 'settings-tab') { } else if (tabName === 'settings-tab') {
loadSshDetails(); loadSshDetails();
updateFileBrowserStatus(); // Remove updateFileBrowserStatus() from here
} }
} }
@ -3604,43 +3604,26 @@
const response = await fetch(`/${action}_filebrowser`); const response = await fetch(`/${action}_filebrowser`);
const result = await response.json(); const result = await response.json();
if (result.status === 'started' || result.status === 'stopped') { if (result.status === 'started' || result.status === 'stopped') {
updateFileBrowserStatus(); // Remove updateFileBrowserStatus() from here
} }
} catch (error) { } catch (error) {
console.error('Error controlling File Browser:', error); console.error('Error controlling File Browser:', error);
} }
} }
function updateFileBrowserStatus() {
fetch('/filebrowser_status')
.then(response => response.json())
.then(data => {
const statusElement = document.getElementById('filebrowser-status');
if (statusElement) {
statusElement.textContent = data.status;
}
const startButton = document.getElementById('start-filebrowser');
const stopButton = document.getElementById('stop-filebrowser');
if (startButton && stopButton) {
startButton.disabled = (data.status === 'running');
stopButton.disabled = (data.status === 'stopped');
}
})
.catch(error => console.error('Error updating File Browser status:', error));
}
// Reduce the frequency of status updates // Reduce the frequency of status updates
setInterval(updateFileBrowserStatus, 30000); // Check every 30 seconds instead of 5 seconds // Remove this interval
// setInterval(updateFileBrowserStatus, 30000); // Check every 30 seconds instead of 5 seconds
// Update the DOMContentLoaded event listener // Update the DOMContentLoaded event listener
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
updateFileBrowserStatus(); loadSshDetails();
// ... (other initialization code) // ... (other initialization code)
}); });
// Call this function when the Settings tab is opened // Update the Settings tab click handler
document.querySelector('.navbar-tabs a[onclick="openTab(event, \'settings-tab\')"]').addEventListener('click', function() { document.querySelector('.navbar-tabs a[onclick="openTab(event, \'settings-tab\')"]').addEventListener('click', function() {
loadSshDetails(); loadSshDetails();
updateFileBrowserStatus(); // Remove updateFileBrowserStatus() from here
}); });
async function installApp(appKey) { async function installApp(appKey) {