Spaces:
Paused
Paused
Update templates/index_new.html
Browse files- templates/index_new.html +111 -2
templates/index_new.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html lang="
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
@@ -9,7 +9,16 @@
|
|
| 9 |
|
| 10 |
</head>
|
| 11 |
<body class="antialiased">
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
<div class="min-h-screen bg-background flex items-center justify-center p-4 sm:p-8">
|
| 14 |
<div class="toast-container">
|
| 15 |
<div id="toast" class="toast"></div>
|
|
@@ -1499,5 +1508,105 @@ document.getElementById('getSubtitlesBtn').addEventListener('click', async funct
|
|
| 1499 |
}
|
| 1500 |
});
|
| 1501 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1502 |
</body>
|
| 1503 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html lang="cs" class="dark">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
| 9 |
|
| 10 |
</head>
|
| 11 |
<body class="antialiased">
|
| 12 |
+
<!-- Status Container -->
|
| 13 |
+
<div id="statusContainer" class="fixed top-4 right-4 bg-card p-4" style="z-index: 1000;">
|
| 14 |
+
<div id="xttsStatus" class="mb-2"></div>
|
| 15 |
+
<div id="piperStatus" class="mb-2"></div>
|
| 16 |
+
<div id="ngrokStatus" class="mb-2"></div>
|
| 17 |
+
</div>
|
| 18 |
+
<!-- Log messages container -->
|
| 19 |
+
<div id="logContainer" class="fixed bottom-4 right-4 max-w-md bg-card p-4 rounded-lg shadow-lg overflow-y-auto max-h-60" style="z-index: 1000; display:none !important;">
|
| 20 |
+
<div class="text-sm font-mono" id="logMessages"></div>
|
| 21 |
+
</div>
|
| 22 |
<div class="min-h-screen bg-background flex items-center justify-center p-4 sm:p-8">
|
| 23 |
<div class="toast-container">
|
| 24 |
<div id="toast" class="toast"></div>
|
|
|
|
| 1508 |
}
|
| 1509 |
});
|
| 1510 |
</script>
|
| 1511 |
+
<script>
|
| 1512 |
+
// Connect to SSE endpoint for logs
|
| 1513 |
+
const eventSource = new EventSource('/logs');
|
| 1514 |
+
const logMessages = document.getElementById('logMessages');
|
| 1515 |
+
|
| 1516 |
+
eventSource.onmessage = function(event) {
|
| 1517 |
+
const data = JSON.parse(event.data);
|
| 1518 |
+
|
| 1519 |
+
// Skip keepalive messages
|
| 1520 |
+
if (data.message === 'keepalive') return;
|
| 1521 |
+
|
| 1522 |
+
// Create log message element
|
| 1523 |
+
const logElement = document.createElement('div');
|
| 1524 |
+
logElement.className = `log-message ${data.level.toLowerCase()}`;
|
| 1525 |
+
logElement.textContent = data.message;
|
| 1526 |
+
|
| 1527 |
+
// Add to container and scroll to bottom
|
| 1528 |
+
logMessages.appendChild(logElement);
|
| 1529 |
+
logMessages.scrollTop = logMessages.scrollHeight;
|
| 1530 |
+
|
| 1531 |
+
// Keep only last 50 messages
|
| 1532 |
+
while (logMessages.children.length > 50) {
|
| 1533 |
+
logMessages.removeChild(logMessages.firstChild);
|
| 1534 |
+
}
|
| 1535 |
+
};
|
| 1536 |
+
|
| 1537 |
+
// Add some basic styles for status indicators
|
| 1538 |
+
const statusStyle = document.createElement('style');
|
| 1539 |
+
statusStyle.textContent = `
|
| 1540 |
+
#statusContainer {
|
| 1541 |
+
background: none;
|
| 1542 |
+
color: white;
|
| 1543 |
+
font-size: 0.875rem;
|
| 1544 |
+
}
|
| 1545 |
+
.status-indicator {
|
| 1546 |
+
display: inline-block;
|
| 1547 |
+
width: 8px;
|
| 1548 |
+
height: 8px;
|
| 1549 |
+
border-radius: 50%;
|
| 1550 |
+
margin-right: 8px;
|
| 1551 |
+
}
|
| 1552 |
+
.status-enabled {
|
| 1553 |
+
background-color: #10b981;
|
| 1554 |
+
}
|
| 1555 |
+
.status-disabled {
|
| 1556 |
+
background-color: #ef4444;
|
| 1557 |
+
}
|
| 1558 |
+
`;
|
| 1559 |
+
document.head.appendChild(statusStyle);
|
| 1560 |
+
|
| 1561 |
+
// Get all statuses when page loads
|
| 1562 |
+
fetch('/get_status')
|
| 1563 |
+
.then(response => response.json())
|
| 1564 |
+
.then(data => {
|
| 1565 |
+
// Update status elements
|
| 1566 |
+
const xttsStatus = document.getElementById('xttsStatus');
|
| 1567 |
+
const piperStatus = document.getElementById('piperStatus');
|
| 1568 |
+
const ngrokStatus = document.getElementById('ngrokStatus');
|
| 1569 |
+
|
| 1570 |
+
xttsStatus.innerHTML = `
|
| 1571 |
+
<span class="status-indicator ${data.xtts_enabled ? 'status-enabled' : 'status-disabled'}"></span>
|
| 1572 |
+
XTTS: ${data.xtts_enabled ? 'online' : 'offline'}
|
| 1573 |
+
`;
|
| 1574 |
+
|
| 1575 |
+
piperStatus.innerHTML = `
|
| 1576 |
+
<span class="status-indicator ${data.piper_enabled ? 'status-enabled' : 'status-disabled'}"></span>
|
| 1577 |
+
Piper: ${data.piper_enabled ? 'online' : 'offline'}
|
| 1578 |
+
`;
|
| 1579 |
+
|
| 1580 |
+
ngrokStatus.innerHTML = `
|
| 1581 |
+
<span class="status-indicator ${data.ngrok_server_online ? 'status-enabled' : 'status-disabled'}"></span>
|
| 1582 |
+
YT server: ${data.ngrok_server_online ? 'online' : 'offline'}
|
| 1583 |
+
`;
|
| 1584 |
+
|
| 1585 |
+
// Also log to console and log container as before
|
| 1586 |
+
console.log('XTTS:', data.xtts_enabled ? 'enabled' : 'disabled');
|
| 1587 |
+
console.log('Piper:', data.piper_enabled ? 'enabled' : 'disabled');
|
| 1588 |
+
console.log('Ngrok server:', data.ngrok_server_online ? 'online' : 'offline');
|
| 1589 |
+
|
| 1590 |
+
const messages = [
|
| 1591 |
+
`XTTS is ${data.xtts_enabled ? 'enabled' : 'disabled'}`,
|
| 1592 |
+
`Piper is ${data.piper_enabled ? 'enabled' : 'disabled'}`,
|
| 1593 |
+
`Ngrok server is ${data.ngrok_server_online ? 'online' : 'offline'}`
|
| 1594 |
+
];
|
| 1595 |
+
|
| 1596 |
+
messages.forEach(message => {
|
| 1597 |
+
const logElement = document.createElement('div');
|
| 1598 |
+
logElement.className = 'log-message info';
|
| 1599 |
+
logElement.textContent = message;
|
| 1600 |
+
logMessages.appendChild(logElement);
|
| 1601 |
+
});
|
| 1602 |
+
})
|
| 1603 |
+
.catch(error => {
|
| 1604 |
+
console.error('Error fetching status:', error);
|
| 1605 |
+
const logElement = document.createElement('div');
|
| 1606 |
+
logElement.className = 'log-message error';
|
| 1607 |
+
logElement.textContent = 'Error fetching server status';
|
| 1608 |
+
logMessages.appendChild(logElement);
|
| 1609 |
+
});
|
| 1610 |
+
</script>
|
| 1611 |
</body>
|
| 1612 |
</html>
|