fix start button to reenable restart button

This commit is contained in:
MCHost
2025-07-06 21:38:59 -04:00
parent fde426b51c
commit 7c9fccc683

View File

@@ -2181,8 +2181,13 @@ function updateModListPagination() {
state.serverStatus = message.data?.status || 'Unknown';
elements.serverStatus.textContent = state.serverStatus;
toggleSections(state.serverStatus);
if (message.data?.status === 'running') {
if (message.data?.status.toLowerCase() === 'running') {
updateNotification(notification, 'Server started successfully', 'success', key);
// Ensure restart button is enabled
if (elements.restartBtn) {
elements.restartBtn.disabled = false;
elements.restartBtn.classList.remove('disabled-btn');
}
ws.removeEventListener('message', messageHandler);
}
}
@@ -2194,7 +2199,7 @@ function updateModListPagination() {
setTimeout(() => {
if (ws && ws.readyState === WebSocket.OPEN) {
ws.removeEventListener('message', messageHandler);
if (state.serverStatus !== 'running') {
if (state.serverStatus.toLowerCase() !== 'running') {
updateNotification(notification, 'Failed to start server. Please try again.', 'error', key);
toggleSections(state.serverStatus);
}