Enhance display customization and remove PHP server
Major improvements to display configuration and server architecture: **Display Enhancements:** - Add URL parameters for display customization (timestamps, maxlines, fontsize, fontfamily) - Fix max lines enforcement to prevent scroll bars in OBS - Apply font family and size settings to both local and sync displays - Remove auto-scroll, enforce overflow:hidden for clean OBS integration **Node.js Server:** - Add timestamps toggle: timestamps=true/false - Add max lines limit: maxlines=50 - Add font configuration: fontsize=16, fontfamily=Arial - Update index page with URL parameters documentation - Improve display URLs in room generation **Local Web Server:** - Add max_lines, font_family, font_size configuration - Respect settings from GUI configuration - Apply changes immediately without restart **Architecture:** - Remove PHP server implementation (Node.js recommended) - Update all documentation to reference Node.js server - Update default config URLs to Node.js endpoints - Clean up 1700+ lines of PHP code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ from datetime import datetime
|
||||
class TranscriptionWebServer:
|
||||
"""Web server for displaying transcriptions."""
|
||||
|
||||
def __init__(self, host: str = "127.0.0.1", port: int = 8080, show_timestamps: bool = True, fade_after_seconds: int = 10):
|
||||
def __init__(self, host: str = "127.0.0.1", port: int = 8080, show_timestamps: bool = True, fade_after_seconds: int = 10, max_lines: int = 50, font_family: str = "Arial", font_size: int = 16):
|
||||
"""
|
||||
Initialize web server.
|
||||
|
||||
@@ -20,11 +20,17 @@ class TranscriptionWebServer:
|
||||
port: Server port
|
||||
show_timestamps: Whether to show timestamps in transcriptions
|
||||
fade_after_seconds: Time in seconds before transcriptions fade out (0 = never fade)
|
||||
max_lines: Maximum number of lines to display at once
|
||||
font_family: Font family for display
|
||||
font_size: Font size in pixels
|
||||
"""
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.show_timestamps = show_timestamps
|
||||
self.fade_after_seconds = fade_after_seconds
|
||||
self.max_lines = max_lines
|
||||
self.font_family = font_family
|
||||
self.font_size = font_size
|
||||
self.app = FastAPI()
|
||||
self.active_connections: List[WebSocket] = []
|
||||
self.transcriptions = [] # Store recent transcriptions
|
||||
@@ -70,12 +76,13 @@ class TranscriptionWebServer:
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background: transparent;
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: {self.font_family}, sans-serif;
|
||||
font-size: {self.font_size}px;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
}}
|
||||
#transcriptions {{
|
||||
max-height: 100vh;
|
||||
overflow-y: auto;
|
||||
overflow: hidden;
|
||||
}}
|
||||
.transcription {{
|
||||
margin: 10px 0;
|
||||
@@ -120,6 +127,7 @@ class TranscriptionWebServer:
|
||||
const container = document.getElementById('transcriptions');
|
||||
const ws = new WebSocket(`ws://${{window.location.host}}/ws`);
|
||||
const fadeAfterSeconds = {self.fade_after_seconds};
|
||||
const maxLines = {self.max_lines};
|
||||
|
||||
ws.onmessage = (event) => {{
|
||||
const data = JSON.parse(event.data);
|
||||
@@ -154,9 +162,6 @@ class TranscriptionWebServer:
|
||||
div.innerHTML = html;
|
||||
container.appendChild(div);
|
||||
|
||||
// Auto-scroll to bottom
|
||||
container.scrollTop = container.scrollHeight;
|
||||
|
||||
// Set up fade-out if enabled
|
||||
if (fadeAfterSeconds > 0) {{
|
||||
setTimeout(() => {{
|
||||
@@ -172,8 +177,8 @@ class TranscriptionWebServer:
|
||||
}}, fadeAfterSeconds * 1000);
|
||||
}}
|
||||
|
||||
// Limit to 50 transcriptions (fallback)
|
||||
while (container.children.length > 50) {{
|
||||
// Enforce max lines limit
|
||||
while (container.children.length > maxLines) {{
|
||||
container.removeChild(container.firstChild);
|
||||
}}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user