feat(websocket): add WebSocket display backend for browser client

This commit is contained in:
2026-03-15 20:54:03 -07:00
parent 2650f7245e
commit ac1306373d
15 changed files with 1612 additions and 34 deletions

View File

@@ -29,6 +29,18 @@ from engine.terminal import (
slow_print,
tw,
)
from engine.websocket_display import WebSocketDisplay
def _get_display():
"""Get the appropriate display based on config."""
if config.WEBSOCKET:
ws = WebSocketDisplay(host="0.0.0.0", port=config.WEBSOCKET_PORT)
ws.start_server()
ws.start_http_server()
return ws
return None
TITLE = [
" ███╗ ███╗ █████╗ ██╗███╗ ██╗██╗ ██╗███╗ ██╗███████╗",
@@ -343,7 +355,10 @@ def main():
print()
time.sleep(0.4)
stream(items, ntfy, mic)
display = _get_display()
stream(items, ntfy, mic, display)
if display:
display.cleanup()
print()
print(f" {W_GHOST}{'' * (tw() - 4)}{RST}")