|
149 | 149 | .qr-url { color: #4a9eff; font-family: monospace; margin-top: 8px; word-break: break-all; text-decoration: none; transition: color 0.2s; display: block; text-align: center; line-height: 1.3; } |
150 | 150 | .qr-url:hover { color: #7bc0ff; text-decoration: underline; } |
151 | 151 |
|
152 | | - .status { position: fixed; bottom: max(8px, 1.5vh); right: max(8px, 1.5vw); padding: max(4px, 0.8vmin) max(8px, 1.5vmin); border-radius: max(3px, 0.5vmin); font-size: max(10px, min(2vw, 2vh, 14px)); z-index: 1001; transition: opacity 0.3s, visibility 0.3s; opacity: 0.7; } |
| 152 | + .status { position: fixed; bottom: max(8px, 1.5vh); right: max(8px, 1.5vw); padding: max(4px, 0.8vmin) max(8px, 1.5vmin); border-radius: max(3px, 0.5vmin); font-size: max(10px, min(2vw, 2vh, 14px)); z-index: 1001; transition: opacity 0.3s, visibility 0.3s; opacity: 0.7; cursor: pointer; } |
153 | 153 | .status.hidden { opacity: 0; visibility: hidden; } |
154 | 154 | .status.connecting { background: #FF9800; color: #000; } |
155 | 155 | .status.connected { background: #4CAF50; color: #fff; } |
| 156 | + .status.disconnected { background: #666; color: #fff; } |
156 | 157 | .status.error { background: #f44336; color: #fff; } |
157 | 158 |
|
158 | 159 | #audioMutedIndicator { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.9); color: white; padding: 12px 24px; border-radius: 8px; font-size: 16px; z-index: 3000; cursor: pointer; display: none; align-items: center; gap: 10px; border: 1px solid rgba(255, 255, 255, 0.2); } |
|
340 | 341 | el.textContent = text; |
341 | 342 | } |
342 | 343 |
|
| 344 | + // Network status: poll connection info and display WiFi SSID / Ethernet / Disconnected |
| 345 | + let _networkPollInterval = null; |
| 346 | + function updateNetworkStatus() { |
| 347 | + fetch('/api/network-info').then(r => r.json()).then(info => { |
| 348 | + const conn = info.connection; |
| 349 | + if (conn?.type === 'wifi') updateStatus('connected', '📶 ' + conn.name); |
| 350 | + else if (conn?.type === 'ethernet') updateStatus('connected', '🔌 Ethernet'); |
| 351 | + else updateStatus('disconnected', '⚠ No Internet'); |
| 352 | + }).catch(() => updateStatus('disconnected', '⚠ No Internet')); |
| 353 | + } |
| 354 | + // Poll network status every 10s to catch changes |
| 355 | + _networkPollInterval = setInterval(updateNetworkStatus, 10000); |
| 356 | + |
| 357 | + // Click status label → open WiFi Manager |
| 358 | + document.getElementById('status').addEventListener('click', () => { |
| 359 | + window.location.href = 'http://' + window.location.hostname + ':3457'; |
| 360 | + }); |
| 361 | + |
343 | 362 | function connectWebSocket() { |
344 | 363 | updateStatus('connecting', 'Connecting...'); |
345 | 364 | wsManager = new WebSocketManager({ |
|
364 | 383 | switch (msg.type) { |
365 | 384 | case 'registered': |
366 | 385 | console.log('Screen registered:', msg.screenId); |
367 | | - updateStatus('connected', 'Ready: ' + screenId); |
| 386 | + updateNetworkStatus(); |
368 | 387 | break; |
369 | 388 |
|
370 | 389 | case 'controller-connected': |
|
0 commit comments