554 lines
19 KiB
HTML
554 lines
19 KiB
HTML
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Room: {{ room.name }} - Video Streaming Server</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
:root {
|
|
--primary: #667eea;
|
|
--secondary: #764ba2;
|
|
--success: #10b981;
|
|
--danger: #ef4444;
|
|
--warning: #f59e0b;
|
|
--info: #3b82f6;
|
|
--dark: #1f2937;
|
|
--light: #f9fafb;
|
|
--gray: #6b7280;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: #f3f4f6;
|
|
color: var(--dark);
|
|
}
|
|
|
|
/* Sidebar */
|
|
.sidebar {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100vh;
|
|
width: 250px;
|
|
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
|
color: white;
|
|
padding: 20px 0;
|
|
box-shadow: 0 0 20px rgba(0,0,0,0.1);
|
|
z-index: 1000;
|
|
}
|
|
|
|
.logo {
|
|
padding: 0 20px 30px;
|
|
border-bottom: 1px solid rgba(255,255,255,0.1);
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.logo h1 {
|
|
font-size: 24px;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.logo p {
|
|
font-size: 12px;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.nav-links {
|
|
list-style: none;
|
|
padding: 0 20px;
|
|
}
|
|
|
|
.nav-links li {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.nav-links a {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 12px 15px;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 5px;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.nav-links a:hover {
|
|
background: rgba(255,255,255,0.1);
|
|
}
|
|
|
|
.nav-links a.active {
|
|
background: rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.nav-links i {
|
|
margin-right: 10px;
|
|
width: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.back-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 12px 15px;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 5px;
|
|
transition: background 0.3s;
|
|
background: rgba(255,255,255,0.1);
|
|
margin: 20px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.back-btn:hover {
|
|
background: rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.back-btn i {
|
|
margin-right: 10px;
|
|
}
|
|
|
|
/* Main Content */
|
|
.main-content {
|
|
margin-left: 250px;
|
|
padding: 30px;
|
|
}
|
|
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.header h2 {
|
|
font-size: 28px;
|
|
color: var(--dark);
|
|
}
|
|
|
|
.room-info {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
margin-bottom: 30px;
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
|
|
}
|
|
|
|
.room-info-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 20px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.info-item {
|
|
padding: 15px;
|
|
background: var(--light);
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.info-item label {
|
|
display: block;
|
|
font-size: 12px;
|
|
color: var(--gray);
|
|
margin-bottom: 5px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.info-item .value {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: var(--dark);
|
|
}
|
|
|
|
/* Clients Table */
|
|
.clients-section {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
margin-bottom: 30px;
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 20px;
|
|
color: var(--dark);
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
thead {
|
|
background: var(--light);
|
|
}
|
|
|
|
th {
|
|
padding: 15px;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
color: var(--gray);
|
|
border-bottom: 2px solid #e5e7eb;
|
|
}
|
|
|
|
td {
|
|
padding: 15px;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
}
|
|
|
|
tr:hover {
|
|
background: var(--light);
|
|
}
|
|
|
|
.status-badge {
|
|
display: inline-block;
|
|
padding: 5px 10px;
|
|
border-radius: 20px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.status-streaming {
|
|
background: #d1fae5;
|
|
color: var(--success);
|
|
}
|
|
|
|
.status-idle {
|
|
background: #fef3c7;
|
|
color: var(--warning);
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.btn {
|
|
padding: 8px 16px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-weight: 600;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
transition: all 0.3s;
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: var(--danger);
|
|
color: white;
|
|
}
|
|
|
|
.btn-success {
|
|
background: var(--success);
|
|
color: white;
|
|
}
|
|
|
|
.btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.btn-sm {
|
|
padding: 5px 10px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 50px;
|
|
color: var(--gray);
|
|
}
|
|
|
|
/* Connection Info */
|
|
.connection-info {
|
|
background: #f0f9ff;
|
|
border: 1px solid #bae6fd;
|
|
border-radius: 5px;
|
|
padding: 15px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.connection-info h4 {
|
|
color: #0369a1;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.connection-info code {
|
|
background: #e0f2fe;
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-family: monospace;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
.sidebar {
|
|
width: 70px;
|
|
}
|
|
|
|
.sidebar .logo h1,
|
|
.sidebar .logo p,
|
|
.sidebar .nav-links span,
|
|
.sidebar .back-btn span {
|
|
display: none;
|
|
}
|
|
|
|
.sidebar .nav-links a {
|
|
justify-content: center;
|
|
}
|
|
|
|
.sidebar .nav-links i {
|
|
margin-right: 0;
|
|
font-size: 20px;
|
|
}
|
|
|
|
.sidebar .back-btn {
|
|
justify-content: center;
|
|
}
|
|
|
|
.main-content {
|
|
margin-left: 70px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Sidebar -->
|
|
<div class="sidebar">
|
|
<div class="logo">
|
|
<h1>🎥 VSS</h1>
|
|
<p>Video Streaming Server</p>
|
|
</div>
|
|
|
|
<ul class="nav-links">
|
|
<li>
|
|
<a href="/dashboard">
|
|
<i class="fas fa-tachometer-alt"></i>
|
|
<span>Dashboard</span>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="/create-room">
|
|
<i class="fas fa-plus-circle"></i>
|
|
<span>Create Room</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<a href="/dashboard" class="back-btn">
|
|
<i class="fas fa-arrow-left"></i>
|
|
<span>Back to Dashboard</span>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="main-content">
|
|
<!-- Header -->
|
|
<div class="header">
|
|
<h2>Room: {{ room.name }}</h2>
|
|
<div class="action-buttons">
|
|
<button class="btn btn-danger" onclick="deleteRoom('{{ room.id }}')">
|
|
<i class="fas fa-trash"></i> Delete Room
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Room Information -->
|
|
<div class="room-info">
|
|
<h3 class="section-title">Room Information</h3>
|
|
<div class="room-info-grid">
|
|
<div class="info-item">
|
|
<label>Room ID</label>
|
|
<div class="value"><code>{{ room.id }}</code></div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Password</label>
|
|
<div class="value">{{ room.password }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Max Connections</label>
|
|
<div class="value">{{ room.max_connections }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Created</label>
|
|
<div class="value">{{ room.created_at }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Created By</label>
|
|
<div class="value">{{ room.created_by }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Active Clients</label>
|
|
<div class="value">{{ room_stats.total_clients }} / {{ room.max_connections }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Active Streams</label>
|
|
<div class="value">{{ room_stats.active_streams }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<label>Data Transferred</label>
|
|
<div class="value">{{ (room_stats.bytes_transferred / 1024 / 1024)|round(2) }} MB</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Connection Info for Clients -->
|
|
<div class="connection-info">
|
|
<h4>Client Connection Information</h4>
|
|
<p>Clients can connect to this room using:</p>
|
|
<p><strong>WebSocket URL:</strong> <code>{{ 'wss' if ssl_enabled else 'ws' }}://{{ server_host }}:{{ server_port }}/ws/client/{{ room.id }}/{{ room.password }}</code></p>
|
|
<p><strong>Room ID:</strong> <code>{{ room.id }}</code></p>
|
|
<p><strong>Password:</strong> <code>{{ room.password }}</code></p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Connected Clients -->
|
|
<div class="clients-section">
|
|
<div class="section-header">
|
|
<h3 class="section-title">Connected Clients ({{ clients|length }})</h3>
|
|
<button class="btn btn-primary" onclick="refreshClients()">
|
|
<i class="fas fa-sync-alt"></i> Refresh
|
|
</button>
|
|
</div>
|
|
|
|
{% if clients %}
|
|
<div class="table-responsive">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Client ID</th>
|
|
<th>IP Address</th>
|
|
<th>Connected At</th>
|
|
<th>Status</th>
|
|
<th>Video Settings</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for client in clients %}
|
|
<tr>
|
|
<td><code>{{ client.id[:8] }}...</code></td>
|
|
<td>{{ client.ip_address }}</td>
|
|
<td>{{ client.connected_at }}</td>
|
|
<td>
|
|
{% if client.is_streaming %}
|
|
<span class="status-badge status-streaming">Streaming</span>
|
|
{% else %}
|
|
<span class="status-badge status-idle">Idle</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{{ client.video_settings.quality }}% Quality<br>
|
|
{{ client.video_settings.frame_rate }} FPS
|
|
</td>
|
|
<td>
|
|
<div class="action-buttons">
|
|
<a href="/stream/{{ client.id }}">
|
|
<button class="btn btn-primary btn-sm">
|
|
<i class="fas fa-play"></i> Stream
|
|
</button>
|
|
</a>
|
|
<button class="btn btn-danger btn-sm" onclick="disconnectClient('{{ client.id }}')">
|
|
<i class="fas fa-sign-out-alt"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<p>No clients connected to this room yet.</p>
|
|
<p>Share the connection information above with clients.</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function deleteRoom(roomId) {
|
|
if (confirm('Are you sure you want to delete this room? All clients will be disconnected.')) {
|
|
try {
|
|
const response = await fetch(`/api/delete-room/${roomId}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
alert('Room deleted successfully!');
|
|
window.location.href = '/dashboard';
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Failed to delete room'));
|
|
}
|
|
} catch (error) {
|
|
alert('Error: ' + error.message);
|
|
}
|
|
}
|
|
}
|
|
|
|
async function disconnectClient(clientId) {
|
|
if (confirm('Are you sure you want to disconnect this client?')) {
|
|
try {
|
|
const response = await fetch(`/api/disconnect-client/${clientId}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
alert('Client disconnected successfully!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Failed to disconnect client'));
|
|
}
|
|
} catch (error) {
|
|
alert('Error: ' + error.message);
|
|
}
|
|
}
|
|
}
|
|
|
|
function refreshClients() {
|
|
location.reload();
|
|
}
|
|
|
|
// Auto-refresh every 10 seconds
|
|
setInterval(refreshClients, 10000);
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|