feat: initial release — SRT Streamer v1.0.0

Cross-platform Electron + React + FFmpeg desktop app for sending
multiple SRT streams simultaneously.

Features:
- Multiple simultaneous SRT output streams
- Video sources: desktop, window capture, cameras, capture cards
- Audio sources: microphones, system loopback, sound cards
- H.264 encoding with HW acceleration (NVENC/QSV/AMF/VideoToolbox)
- SRT modes: caller / listener / rendezvous
- Frame profile presets (4K, 1080p, 720p, 480p, 360p)
- Tolbek SRT receiver with configurable mode
- System tray: minimize-to-tray, exit confirmation dialog
- Portable build via electron-builder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
admin
2026-04-16 00:37:40 +03:00
commit 1f7dbc2a7d
25 changed files with 10548 additions and 0 deletions
+236
View File
@@ -0,0 +1,236 @@
import React, { useState, useEffect, useCallback } from 'react'
import StreamCard from './components/StreamCard.jsx'
import TolbekSettings from './components/TolbekSettings.jsx'
import LogPanel from './components/LogPanel.jsx'
const ipc = window.electronAPI || null
const DEFAULT_STREAM = () => ({
id: `stream_${Date.now()}`,
name: 'Stream 1',
videoSource: { type: 'desktop', deviceName: '', hideCursor: false },
audioSource: { type: 'none', deviceName: '' },
serverAddress: '',
port: '4900',
srtMode: 'caller',
latency: 200,
resolution: '1920x1080',
framerate: 30,
videoBitrate: '4000k',
audioBitrate: '128k',
hwAccel: 'auto',
status: 'idle'
})
export default function App() {
const [streams, setStreams] = useState([DEFAULT_STREAM()])
const [tolbek, setTolbek] = useState({ enabled: false, port: 5000, latency: 200 })
const [devices, setDevices] = useState({ video: [], audio: [] })
const [windows, setWindows] = useState([])
const [logs, setLogs] = useState([])
const [activeTab, setActiveTab] = useState('streams')
const [devicesLoaded, setDevicesLoaded] = useState(false)
// Load config and devices on mount
useEffect(() => {
if (!ipc) return
ipc.getConfig().then(config => {
if (config.streams && config.streams.length > 0) {
setStreams(config.streams.map(s => ({ ...s, status: 'idle' })))
}
if (config.tolbek) setTolbek(config.tolbek)
})
ipc.getDevices().then(devs => {
setDevices(devs)
setDevicesLoaded(true)
})
ipc.getWindows().then(wins => setWindows(wins))
}, [])
// Subscribe to stream events
useEffect(() => {
if (!ipc) return
const handleStatus = ({ id, status }) => {
setStreams(prev => prev.map(s => s.id === id ? { ...s, status } : s))
}
const handleLog = ({ id, text }) => {
setLogs(prev => [...prev.slice(-499), { id, text: text.trim(), time: Date.now() }])
}
const handleError = ({ id, error }) => {
setStreams(prev => prev.map(s => s.id === id ? { ...s, status: 'error' } : s))
setLogs(prev => [...prev.slice(-499), { id, text: `ERROR: ${error}`, time: Date.now(), isError: true }])
}
const handleEnded = ({ id }) => {
setStreams(prev => prev.map(s => s.id === id ? { ...s, status: 'idle' } : s))
}
const handleAllStopped = () => {
setStreams(prev => prev.map(s => ({ ...s, status: 'idle' })))
}
ipc.onStreamStatus(handleStatus)
ipc.onStreamLog(handleLog)
ipc.onStreamError(handleError)
ipc.onStreamEnded(handleEnded)
ipc.onAllStreamsStopped(handleAllStopped)
return () => {
ipc.removeAllListeners('stream-status')
ipc.removeAllListeners('stream-log')
ipc.removeAllListeners('stream-error')
ipc.removeAllListeners('stream-ended')
ipc.removeAllListeners('all-streams-stopped')
}
}, [])
// Persist config when streams/tolbek change
useEffect(() => {
if (!ipc) return
const saveData = { streams: streams.map(s => { const {status, ...rest} = s; return rest }), tolbek }
ipc.saveConfig(saveData)
ipc.updateTrayCount(streams.filter(s => s.status === 'running').length)
}, [streams, tolbek])
const addStream = useCallback(() => {
const newStream = DEFAULT_STREAM()
newStream.name = `Stream ${streams.length + 1}`
setStreams(prev => [...prev, newStream])
}, [streams.length])
const updateStream = useCallback((id, changes) => {
setStreams(prev => prev.map(s => s.id === id ? { ...s, ...changes } : s))
}, [])
const removeStream = useCallback((id) => {
if (ipc) ipc.stopStream(id)
setStreams(prev => prev.filter(s => s.id !== id))
}, [])
const startStream = useCallback(async (id) => {
if (!ipc) return
const stream = streams.find(s => s.id === id)
if (!stream) return
setStreams(prev => prev.map(s => s.id === id ? { ...s, status: 'connecting' } : s))
const result = await ipc.startStream(stream)
if (!result.success) {
setStreams(prev => prev.map(s => s.id === id ? { ...s, status: 'error' } : s))
setLogs(prev => [...prev, { id, text: `Failed to start: ${result.error}`, time: Date.now(), isError: true }])
}
}, [streams])
const stopStream = useCallback(async (id) => {
if (!ipc) return
await ipc.stopStream(id)
setStreams(prev => prev.map(s => s.id === id ? { ...s, status: 'idle' } : s))
}, [])
const refreshDevices = useCallback(() => {
if (!ipc) return
setDevicesLoaded(false)
ipc.getDevices().then(devs => {
setDevices(devs)
setDevicesLoaded(true)
})
ipc.getWindows().then(wins => setWindows(wins))
}, [])
const handleMinimize = () => ipc && ipc.minimizeWindow()
const handleHide = () => ipc && ipc.hideWindow()
const activeCount = streams.filter(s => s.status === 'running' || s.status === 'connecting').length
return (
<div className="app">
{/* Title Bar */}
<div className="titlebar" style={{ WebkitAppRegion: 'drag' }}>
<div className="titlebar-left">
<span className="app-logo"></span>
<span className="app-title">SRT Streamer</span>
{activeCount > 0 && (
<span className="active-badge">{activeCount} active</span>
)}
</div>
<div className="titlebar-controls" style={{ WebkitAppRegion: 'no-drag' }}>
<button className="tb-btn" onClick={handleMinimize} title="Minimize">&#8722;</button>
<button className="tb-btn" onClick={handleHide} title="Hide to tray">&#215;</button>
</div>
</div>
{/* Tab Bar */}
<div className="tabbar">
<button
className={`tab ${activeTab === 'streams' ? 'active' : ''}`}
onClick={() => setActiveTab('streams')}
>
Streams
{activeCount > 0 && <span className="tab-badge">{activeCount}</span>}
</button>
<button
className={`tab ${activeTab === 'tolbek' ? 'active' : ''}`}
onClick={() => setActiveTab('tolbek')}
>
Tolbek (Receiver)
{tolbek.running && <span className="tab-badge tab-badge--green"></span>}
</button>
<button
className={`tab ${activeTab === 'logs' ? 'active' : ''}`}
onClick={() => setActiveTab('logs')}
>
Logs
{logs.some(l => l.isError) && <span className="tab-badge tab-badge--red">!</span>}
</button>
<div className="tabbar-spacer" />
<button className="tab tab--icon" onClick={refreshDevices} title="Refresh device list">
Devices
</button>
</div>
{/* Content */}
<div className="content">
{activeTab === 'streams' && (
<div className="streams-view">
<div className="streams-grid">
{streams.map(stream => (
<StreamCard
key={stream.id}
stream={stream}
devices={devices}
windows={windows}
devicesLoaded={devicesLoaded}
onChange={(changes) => updateStream(stream.id, changes)}
onStart={() => startStream(stream.id)}
onStop={() => stopStream(stream.id)}
onRemove={() => removeStream(stream.id)}
/>
))}
<button className="add-stream-btn" onClick={addStream}>
<span className="add-icon">+</span>
<span>Add Stream</span>
</button>
</div>
</div>
)}
{activeTab === 'tolbek' && (
<TolbekSettings
config={tolbek}
onChange={setTolbek}
ipc={ipc}
/>
)}
{activeTab === 'logs' && (
<LogPanel
logs={logs}
streams={streams}
onClear={() => setLogs([])}
/>
)}
</div>
</div>
)
}
+83
View File
@@ -0,0 +1,83 @@
import React, { useRef, useEffect, useState } from 'react'
export default function LogPanel({ logs, streams, onClear }) {
const bottomRef = useRef(null)
const [filter, setFilter] = useState('all')
const [autoScroll, setAutoScroll] = useState(true)
useEffect(() => {
if (autoScroll && bottomRef.current) {
bottomRef.current.scrollIntoView({ behavior: 'smooth' })
}
}, [logs, autoScroll])
const filtered = filter === 'all'
? logs
: filter === 'errors'
? logs.filter(l => l.isError)
: logs.filter(l => l.id === filter)
const streamOptions = [...new Set(logs.map(l => l.id))].filter(Boolean)
return (
<div className="log-panel">
<div className="log-toolbar">
<div className="log-filters">
<button
className={`filter-btn ${filter === 'all' ? 'active' : ''}`}
onClick={() => setFilter('all')}
>
All
</button>
<button
className={`filter-btn ${filter === 'errors' ? 'active' : ''}`}
onClick={() => setFilter('errors')}
>
Errors
</button>
{streamOptions.map(id => {
const stream = streams.find(s => s.id === id)
return (
<button
key={id}
className={`filter-btn ${filter === id ? 'active' : ''}`}
onClick={() => setFilter(id)}
>
{stream ? stream.name : id}
</button>
)
})}
</div>
<div className="log-actions">
<label className="checkbox-label">
<input
type="checkbox"
checked={autoScroll}
onChange={e => setAutoScroll(e.target.checked)}
/>
Auto-scroll
</label>
<button className="btn btn--small" onClick={onClear}>Clear</button>
</div>
</div>
<div className="log-content">
{filtered.length === 0 ? (
<div className="log-empty">No log entries yet. Start a stream to see FFmpeg output.</div>
) : (
filtered.map((entry, i) => (
<div key={i} className={`log-line ${entry.isError ? 'log-line--error' : ''}`}>
<span className="log-stream">[{
entry.id === 'tolbek' ? 'Tolbek'
: streams.find(s => s.id === entry.id)?.name || entry.id
}]</span>
<span className="log-text">{entry.text}</span>
</div>
))
)}
<div ref={bottomRef} />
</div>
</div>
)
}
+127
View File
@@ -0,0 +1,127 @@
import React, { useState } from 'react'
import StreamSettings from './StreamSettings.jsx'
const STATUS_LABELS = {
idle: 'Idle',
connecting: 'Connecting…',
running: 'Live',
error: 'Error'
}
const STATUS_CLASS = {
idle: 'status--idle',
connecting: 'status--connecting',
running: 'status--running',
error: 'status--error'
}
export default function StreamCard({ stream, devices, windows, devicesLoaded, onChange, onStart, onStop, onRemove }) {
const [expanded, setExpanded] = useState(true)
const [editingName, setEditingName] = useState(false)
const [nameValue, setNameValue] = useState(stream.name)
const isActive = stream.status === 'running' || stream.status === 'connecting'
const handleNameBlur = () => {
setEditingName(false)
onChange({ name: nameValue || stream.name })
}
const getStreamSummary = () => {
const parts = []
if (stream.videoSource?.type !== 'none') {
if (stream.videoSource?.type === 'desktop') parts.push('Desktop')
else if (stream.videoSource?.type === 'window') parts.push('Window')
else parts.push(stream.videoSource?.deviceName?.split('(')[0]?.trim() || 'Video')
}
if (stream.audioSource?.type !== 'none') {
parts.push(stream.audioSource?.deviceName?.split('(')[0]?.trim() || 'Audio')
}
const dest = stream.serverAddress
? `${stream.serverAddress}:${stream.port}`
: '→ (not configured)'
return parts.length > 0 ? `${parts.join(' + ')} ${dest}` : dest
}
return (
<div className={`stream-card ${STATUS_CLASS[stream.status] || ''} ${isActive ? 'stream-card--active' : ''}`}>
{/* Card Header */}
<div className="card-header">
<div className="card-header-left">
<div className={`status-dot ${STATUS_CLASS[stream.status]}`} />
{editingName ? (
<input
className="name-input"
value={nameValue}
autoFocus
onChange={e => setNameValue(e.target.value)}
onBlur={handleNameBlur}
onKeyDown={e => { if (e.key === 'Enter') handleNameBlur() }}
onClick={e => e.stopPropagation()}
/>
) : (
<span
className="stream-name"
onClick={(e) => { e.stopPropagation(); setEditingName(true) }}
title="Click to rename"
>
{stream.name}
</span>
)}
<span className="status-label">{STATUS_LABELS[stream.status] || 'Idle'}</span>
</div>
<div className="card-header-right">
{!isActive ? (
<button
className="btn btn--start"
onClick={onStart}
disabled={!stream.serverAddress || !stream.port}
title={!stream.serverAddress ? 'Enter server address first' : 'Start stream'}
>
Start
</button>
) : (
<button className="btn btn--stop" onClick={onStop}>
Stop
</button>
)}
<button
className="btn btn--icon"
onClick={() => setExpanded(v => !v)}
title={expanded ? 'Collapse' : 'Expand'}
>
{expanded ? '▲' : '▼'}
</button>
<button
className="btn btn--icon btn--danger"
onClick={() => { if (window.confirm(`Remove "${stream.name}"?`)) onRemove() }}
title="Remove stream"
disabled={isActive}
>
</button>
</div>
</div>
{/* Summary when collapsed */}
{!expanded && (
<div className="card-summary">{getStreamSummary()}</div>
)}
{/* Settings Panel */}
{expanded && (
<StreamSettings
stream={stream}
devices={devices}
windows={windows}
devicesLoaded={devicesLoaded}
disabled={isActive}
onChange={onChange}
/>
)}
</div>
)
}
+403
View File
@@ -0,0 +1,403 @@
import React, { useState } from 'react'
// ─── Frame profiles ────────────────────────────────────────────────────────────
const FRAME_PROFILES = [
{ label: '— Custom —', value: 'custom', res: null, fps: null, vbr: null },
{ label: '4K UHD · 3840×2160 · 30fps · 20 Mbps', value: '4k30', res: '3840x2160', fps: 30, vbr: '20000k' },
{ label: '4K UHD · 3840×2160 · 60fps · 40 Mbps', value: '4k60', res: '3840x2160', fps: 60, vbr: '40000k' },
{ label: '1080p · 1920×1080 · 60fps · 8 Mbps', value: '1080p60',res: '1920x1080', fps: 60, vbr: '8000k' },
{ label: '1080p · 1920×1080 · 30fps · 4 Mbps', value: '1080p30',res: '1920x1080', fps: 30, vbr: '4000k' },
{ label: '1080p · 1920×1080 · 25fps · 4 Mbps', value: '1080p25',res: '1920x1080', fps: 25, vbr: '4000k' },
{ label: '720p · 1280×720 · 60fps · 4 Mbps', value: '720p60', res: '1280x720', fps: 60, vbr: '4000k' },
{ label: '720p · 1280×720 · 30fps · 2 Mbps', value: '720p30', res: '1280x720', fps: 30, vbr: '2000k' },
{ label: '720p · 1280×720 · 25fps · 2 Mbps', value: '720p25', res: '1280x720', fps: 25, vbr: '2000k' },
{ label: '480p · 854×480 · 30fps · 1 Mbps', value: '480p30', res: '854x480', fps: 30, vbr: '1000k' },
{ label: '480p · 854×480 · 25fps · 1 Mbps', value: '480p25', res: '854x480', fps: 25, vbr: '1000k' },
{ label: '360p · 640×360 · 25fps · 500 kbps', value: '360p', res: '640x360', fps: 25, vbr: '500k' },
]
const RESOLUTIONS = ['3840x2160','2560x1440','1920x1080','1280x720','854x480','640x360','Custom']
const FRAMERATES = ['15','24','25','30','50','60']
const VIDEO_BITRATES = [
{ label: '500 kbps', value: '500k' },
{ label: '1 Mbps', value: '1000k' },
{ label: '2 Mbps', value: '2000k' },
{ label: '4 Mbps', value: '4000k' },
{ label: '6 Mbps', value: '6000k' },
{ label: '8 Mbps', value: '8000k' },
{ label: '12 Mbps', value: '12000k' },
{ label: '20 Mbps', value: '20000k' },
{ label: '40 Mbps', value: '40000k' },
{ label: 'Custom', value: 'custom' },
]
const AUDIO_BITRATES = [
{ label: '64 kbps', value: '64k' },
{ label: '96 kbps', value: '96k' },
{ label: '128 kbps', value: '128k' },
{ label: '192 kbps', value: '192k' },
{ label: '256 kbps', value: '256k' },
{ label: '320 kbps', value: '320k' },
]
const HW_ACCEL_OPTIONS = [
{ label: 'Auto (best available)', value: 'auto' },
{ label: 'NVIDIA NVENC', value: 'nvenc' },
{ label: 'Intel QSV', value: 'qsv' },
{ label: 'AMD AMF', value: 'amf' },
{ label: 'Apple VideoToolbox', value: 'videotoolbox' },
{ label: 'VAAPI (Linux)', value: 'vaapi' },
{ label: 'Software (libx264)', value: 'software' },
]
const SRT_MODES = [
{ label: 'Caller — подключиться к серверу', value: 'caller' },
{ label: 'Listener — принимать подключения', value: 'listener' },
{ label: 'Rendezvous', value: 'rendezvous'},
]
// ─── helpers ──────────────────────────────────────────────────────────────────
function Select({ label, value, onChange, options, disabled, className = '' }) {
return (
<div className={`field ${className}`}>
{label && <label className="field-label">{label}</label>}
<select className="field-select" value={value} onChange={e => onChange(e.target.value)} disabled={disabled}>
{options.map(opt =>
typeof opt === 'string'
? <option key={opt} value={opt}>{opt}</option>
: <option key={opt.value} value={opt.value} disabled={opt.disabled}>{opt.label ?? opt.name ?? opt.value}</option>
)}
</select>
</div>
)
}
function Input({ label, value, onChange, placeholder, disabled, type = 'text', min, max, className = '' }) {
return (
<div className={`field ${className}`}>
{label && <label className="field-label">{label}</label>}
<input
className="field-input" type={type} value={value}
onChange={e => onChange(e.target.value)} placeholder={placeholder}
disabled={disabled} min={min} max={max}
/>
</div>
)
}
// ─── detect current frame profile ─────────────────────────────────────────────
function detectProfile(res, fps, vbr) {
const p = FRAME_PROFILES.find(p =>
p.res === res && p.fps === Number(fps) && p.vbr === vbr
)
return p ? p.value : 'custom'
}
// ─── main component ───────────────────────────────────────────────────────────
export default function StreamSettings({ stream, devices, windows, devicesLoaded, disabled, onChange }) {
const [activeSection, setActiveSection] = useState('source')
const updateVideo = changes => onChange({ videoSource: { ...stream.videoSource, ...changes } })
const updateAudio = changes => onChange({ audioSource: { ...stream.audioSource, ...changes } })
const videoDevices = devices.video || []
const audioDevices = devices.audio || []
// Build grouped video options
const noneOpts = videoDevices.filter(d => d.type === 'none')
const screenOpts = videoDevices.filter(d => d.type === 'desktop')
const cameraOpts = videoDevices.filter(d => d.type === 'device')
const windowOpts = (windows || []).map(w => ({
name: w.title, deviceName: w.title, type: 'window', windowTitle: w.title
}))
const videoOptions = [
...noneOpts,
...(screenOpts.length ? [{ name: '─── Экран / Рабочий стол ───', deviceName: '__sep_screen__', type: 'separator' }] : []),
...screenOpts,
...(windowOpts.length ? [{ name: '─── Окна приложений ───', deviceName: '__sep_win__', type: 'separator' }] : []),
...windowOpts,
...(cameraOpts.length ? [{ name: '─── Камеры / Карты захвата ───',deviceName: '__sep_cam__', type: 'separator' }] : []),
...cameraOpts,
]
const currentVideoName = stream.videoSource?.deviceName || ''
const currentVideoType = stream.videoSource?.type || 'none'
function handleVideoSelect(deviceName) {
if (deviceName.startsWith('__sep_')) return
const allOpts = [...noneOpts, ...screenOpts, ...windowOpts, ...cameraOpts]
const dev = allOpts.find(d => d.deviceName === deviceName || d.name === deviceName)
if (dev) {
updateVideo({
deviceName: dev.deviceName || dev.name,
type: dev.type,
deviceIndex: dev.deviceIndex,
devicePath: dev.devicePath,
windowTitle: dev.windowTitle,
screenIndex: dev.monitorIndex,
})
}
}
function handleAudioSelect(deviceName) {
const dev = audioDevices.find(d => d.deviceName === deviceName || d.name === deviceName)
if (dev) updateAudio({ deviceName: dev.deviceName || dev.name, type: dev.type || 'device' })
}
// Frame profile
const currentProfile = detectProfile(stream.resolution, stream.framerate, stream.videoBitrate)
function applyProfile(profileValue) {
const p = FRAME_PROFILES.find(x => x.value === profileValue)
if (!p || p.value === 'custom') return
onChange({ resolution: p.res, framerate: p.fps, videoBitrate: p.vbr })
}
// Resolution
const currentResolution = RESOLUTIONS.includes(stream.resolution) ? stream.resolution : 'Custom'
const isCustomBitrate = !VIDEO_BITRATES.find(b => b.value === stream.videoBitrate && b.value !== 'custom')
return (
<div className="stream-settings">
{/* Section Tabs */}
<div className="section-tabs">
{['source', 'output', 'encoding'].map(s => (
<button key={s} className={`section-tab ${activeSection === s ? 'active' : ''}`}
onClick={() => setActiveSection(s)}>
{s === 'source' ? 'Источник' : s === 'output' ? 'Вывод / SRT' : 'Кодирование'}
</button>
))}
</div>
{/* ── SOURCE ── */}
{activeSection === 'source' && (
<div className="settings-section">
{/* Video */}
<div className="settings-group">
<div className="group-title">Видеоисточник</div>
<div className="field">
<label className="field-label">Устройство / Источник</label>
{devicesLoaded ? (
<select
className="field-select"
value={currentVideoName}
onChange={e => handleVideoSelect(e.target.value)}
disabled={disabled}
size={1}
>
{videoOptions.map((dev, i) =>
dev.type === 'separator'
? <option key={i} value={dev.deviceName} disabled style={{ color: '#475569', fontStyle: 'italic' }}>
{dev.name}
</option>
: <option key={dev.deviceName || i} value={dev.deviceName || dev.name}>
{dev.name}
</option>
)}
</select>
) : (
<div className="field-loading">Загрузка устройств</div>
)}
</div>
{(currentVideoType === 'desktop' || currentVideoType === 'window') && (
<label className="checkbox-label field">
<input
type="checkbox"
checked={stream.videoSource?.hideCursor || false}
onChange={e => updateVideo({ hideCursor: e.target.checked })}
disabled={disabled}
/>
Скрыть курсор мыши
</label>
)}
</div>
{/* Audio */}
<div className="settings-group">
<div className="group-title">Аудиоисточник</div>
<div className="field">
<label className="field-label">Устройство</label>
{devicesLoaded ? (
<select
className="field-select"
value={stream.audioSource?.deviceName || ''}
onChange={e => handleAudioSelect(e.target.value)}
disabled={disabled}
>
{audioDevices.map((dev, i) => (
<option key={dev.deviceName || i} value={dev.deviceName || dev.name}>
{dev.name}{dev.description ? `${dev.description}` : ''}
</option>
))}
</select>
) : (
<div className="field-loading">Загрузка устройств</div>
)}
</div>
</div>
</div>
)}
{/* ── OUTPUT / SRT ── */}
{activeSection === 'output' && (
<div className="settings-section">
<div className="settings-group">
<div className="group-title">SRT Соединение</div>
<div className="fields-row">
<Input
label="Адрес сервера"
value={stream.serverAddress}
onChange={v => onChange({ serverAddress: v })}
placeholder="192.168.1.100 или domain.com"
disabled={disabled}
className="field--grow"
/>
<Input
label="Порт"
value={stream.port}
onChange={v => onChange({ port: v })}
placeholder="4900"
disabled={disabled}
type="number" min="1" max="65535"
className="field--port"
/>
</div>
<div className="fields-row">
<Select
label="Режим SRT"
value={stream.srtMode}
onChange={v => onChange({ srtMode: v })}
options={SRT_MODES}
disabled={disabled}
className="field--half"
/>
<Input
label="Задержка (мс)"
value={stream.latency}
onChange={v => onChange({ latency: parseInt(v) || 200 })}
placeholder="200"
disabled={disabled}
type="number" min="20" max="8000"
className="field--half"
/>
</div>
<div className="srt-preview">
<span className="srt-preview-label">SRT URL:</span>
<code className="srt-url">
{stream.serverAddress
? `srt://${stream.serverAddress}:${stream.port}?mode=${stream.srtMode}&latency=${(stream.latency||200)*1000}`
: 'srt://(не настроен)'}
</code>
</div>
</div>
</div>
)}
{/* ── ENCODING ── */}
{activeSection === 'encoding' && (
<div className="settings-section">
{/* Frame Profile */}
<div className="settings-group">
<div className="group-title">Профиль кадра</div>
<div className="field">
<label className="field-label">Пресет (устанавливает разрешение, FPS, битрейт)</label>
<select
className="field-select"
value={currentProfile}
onChange={e => applyProfile(e.target.value)}
disabled={disabled}
>
{FRAME_PROFILES.map(p => (
<option key={p.value} value={p.value}>{p.label}</option>
))}
</select>
</div>
</div>
{/* Manual overrides */}
<div className="settings-group">
<div className="group-title">Параметры видео</div>
<div className="fields-row">
<div className="field field--half">
<label className="field-label">Разрешение</label>
<select
className="field-select"
value={currentResolution}
onChange={e => {
if (e.target.value !== 'Custom') onChange({ resolution: e.target.value })
}}
disabled={disabled}
>
{RESOLUTIONS.map(r => <option key={r} value={r}>{r}</option>)}
</select>
{currentResolution === 'Custom' && (
<input
className="field-input field-input--small"
type="text"
value={stream.resolution}
onChange={e => onChange({ resolution: e.target.value })}
placeholder="1920x1080"
disabled={disabled}
/>
)}
</div>
<Select
label="Частота кадров"
value={String(stream.framerate || 30)}
onChange={v => onChange({ framerate: parseInt(v) })}
options={FRAMERATES.map(f => ({ label: `${f} fps`, value: f }))}
disabled={disabled}
className="field--half"
/>
</div>
<div className="fields-row">
<div className="field field--half">
<label className="field-label">Битрейт видео</label>
<select
className="field-select"
value={isCustomBitrate ? 'custom' : stream.videoBitrate}
onChange={e => { if (e.target.value !== 'custom') onChange({ videoBitrate: e.target.value }) }}
disabled={disabled}
>
{VIDEO_BITRATES.map(b => <option key={b.value} value={b.value}>{b.label}</option>)}
</select>
{isCustomBitrate && (
<input
className="field-input field-input--small"
type="text"
value={stream.videoBitrate}
onChange={e => onChange({ videoBitrate: e.target.value })}
placeholder="4000k"
disabled={disabled}
/>
)}
</div>
<Select
label="Битрейт аудио"
value={stream.audioBitrate}
onChange={v => onChange({ audioBitrate: v })}
options={AUDIO_BITRATES}
disabled={disabled || stream.audioSource?.type === 'none'}
className="field--half"
/>
</div>
</div>
<div className="settings-group">
<div className="group-title">Аппаратное ускорение (H.264)</div>
<Select
value={stream.hwAccel || 'auto'}
onChange={v => onChange({ hwAccel: v })}
options={HW_ACCEL_OPTIONS}
disabled={disabled}
/>
</div>
</div>
)}
</div>
)
}
+214
View File
@@ -0,0 +1,214 @@
import React, { useState, useEffect } from 'react'
const SRT_MODES = [
{ value: 'listener', label: 'Listener — ждать входящего подключения' },
{ value: 'caller', label: 'Caller — подключиться к удалённому серверу' },
{ value: 'rendezvous', label: 'Rendezvous — одновременный набор' },
]
export default function TolbekSettings({ config, onChange, ipc }) {
const [status, setStatus] = useState('idle') // idle | connecting | running | error
const [logs, setLogs] = useState([])
const isRunning = status === 'running' || status === 'connecting'
// Subscribe to tolbek-specific log/error/ended events
useEffect(() => {
if (!ipc) return
const handleLog = ({ id, text }) => {
if (id !== 'tolbek') return
setLogs(prev => [...prev.slice(-199), text.trim()])
if (status === 'connecting') setStatus('running')
}
const handleError = ({ id, error }) => {
if (id !== 'tolbek') return
setStatus('error')
setLogs(prev => [...prev, `ERROR: ${error}`])
}
const handleEnded = ({ id }) => {
if (id !== 'tolbek') return
setStatus('idle')
}
ipc.onStreamLog(handleLog)
ipc.onStreamError(handleError)
ipc.onStreamEnded(handleEnded)
return () => {
ipc.removeAllListeners('stream-log')
ipc.removeAllListeners('stream-error')
ipc.removeAllListeners('stream-ended')
}
}, [ipc, status])
const handleStart = async () => {
if (!ipc) return
setStatus('connecting')
setLogs([])
const result = await ipc.startTolbek(config)
if (!result.success) {
setStatus('error')
setLogs([`Ошибка запуска: ${result.error}`])
}
}
const handleStop = async () => {
if (!ipc) return
await ipc.stopTolbek()
setStatus('idle')
}
const update = (key, value) => onChange({ ...config, [key]: value })
const mode = config.mode || 'listener'
const port = config.port || 5000
const latency = config.latency || 200
const serverAddress = config.serverAddress || ''
// Build URL preview
const urlPreview = mode === 'listener'
? `srt://0.0.0.0:${port}?mode=listener&latency=${latency * 1000}`
: mode === 'caller'
? `srt://${serverAddress || 'HOST'}:${port}?mode=caller&latency=${latency * 1000}`
: `srt://${serverAddress || 'HOST'}:${port}?mode=rendezvous&latency=${latency * 1000}`
const statusInfo = {
idle: { cls: 'status--idle', label: 'Не запущен' },
connecting: { cls: 'status--connecting', label: 'Запуск…' },
running: { cls: 'status--running', label: mode === 'listener' ? 'Слушает порт…' : 'Подключён' },
error: { cls: 'status--error', label: 'Ошибка' },
}[status]
return (
<div className="tolbek-settings">
<div className="section-header">
<h2 className="section-title">Tolbek SRT Приёмник</h2>
<p className="section-desc">
Приём одного входящего SRT-потока (обратная связь, мониторинг, IFB).
</p>
</div>
<div className="settings-card">
{/* ── Connection settings ── */}
<div className="settings-group">
<div className="group-title">Подключение</div>
<div className="field">
<label className="field-label">Режим SRT</label>
<select
className="field-select"
value={mode}
onChange={e => update('mode', e.target.value)}
disabled={isRunning}
>
{SRT_MODES.map(m => (
<option key={m.value} value={m.value}>{m.label}</option>
))}
</select>
</div>
{/* Caller / Rendezvous — нужен адрес */}
{(mode === 'caller' || mode === 'rendezvous') && (
<div className="field">
<label className="field-label">Адрес сервера</label>
<input
className="field-input"
type="text"
value={serverAddress}
onChange={e => update('serverAddress', e.target.value)}
placeholder="192.168.1.100 или domain.com"
disabled={isRunning}
/>
</div>
)}
<div className="fields-row">
<div className="field field--port">
<label className="field-label">Порт</label>
<input
className="field-input"
type="number"
value={port}
onChange={e => update('port', parseInt(e.target.value) || 5000)}
min="1" max="65535"
disabled={isRunning}
/>
</div>
<div className="field field--half">
<label className="field-label">Задержка (мс)</label>
<input
className="field-input"
type="number"
value={latency}
onChange={e => update('latency', parseInt(e.target.value) || 200)}
min="20" max="8000"
disabled={isRunning}
/>
</div>
</div>
<div className="srt-preview">
<span className="srt-preview-label">SRT URL:</span>
<code className="srt-url">{urlPreview}</code>
</div>
</div>
{/* ── Status + controls ── */}
<div className="settings-group">
<div className="group-title">Статус</div>
<div className="tolbek-status">
<div className={`status-indicator ${statusInfo.cls}`}>
<div className={`status-dot ${statusInfo.cls}`} />
<span>{statusInfo.label}</span>
</div>
<div className="tolbek-actions">
{!isRunning ? (
<button
className="btn btn--start"
onClick={handleStart}
disabled={mode !== 'listener' && !serverAddress}
title={mode !== 'listener' && !serverAddress ? 'Укажите адрес сервера' : ''}
>
Запустить
</button>
) : (
<button className="btn btn--stop" onClick={handleStop}>
Остановить
</button>
)}
</div>
</div>
{logs.length > 0 && (
<div className="tolbek-log">
{logs.map((line, i) => (
<div key={i} className={`log-line ${line.startsWith('ERROR') ? 'log-line--error' : ''}`}>
<span className="log-text">{line}</span>
</div>
))}
</div>
)}
</div>
{/* ── Info ── */}
<div className="settings-group">
<div className="group-title">Справка по режимам</div>
<div className="tolbek-modes-info">
<div className="mode-row">
<span className="mode-tag">Listener</span>
<span className="mode-desc">Приёмник ждёт входящего подключения на указанном порту. Отправитель использует режим <em>caller</em> и указывает ваш IP.</span>
</div>
<div className="mode-row">
<span className="mode-tag">Caller</span>
<span className="mode-desc">Приёмник сам подключается к удалённому серверу. Укажите адрес и порт источника.</span>
</div>
<div className="mode-row">
<span className="mode-tag">Rendezvous</span>
<span className="mode-desc">Оба конца одновременно набирают соединение. Оба используют одинаковый порт.</span>
</div>
</div>
</div>
</div>
</div>
)
}
+10
View File
@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './styles/App.css'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>
)
+737
View File
@@ -0,0 +1,737 @@
/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg-primary: #0f0f1a;
--bg-secondary: #16213e;
--bg-card: #1a1a2e;
--bg-hover: #1e2a4a;
--bg-input: #0d1117;
--bg-section: #12162a;
--accent: #4f8ef7;
--accent-hover: #6aa0ff;
--accent-dim: rgba(79, 142, 247, 0.15);
--green: #22c55e;
--green-dim: rgba(34, 197, 94, 0.15);
--red: #ef4444;
--red-dim: rgba(239, 68, 68, 0.15);
--orange: #f59e0b;
--orange-dim: rgba(245, 158, 11, 0.15);
--text-primary: #e2e8f0;
--text-secondary: #94a3b8;
--text-muted: #475569;
--text-code: #7dd3fc;
--border: #1e2a4a;
--border-bright: #2d3f6a;
--border-focus: #4f8ef7;
--radius-sm: 6px;
--radius: 10px;
--radius-lg: 14px;
--shadow: 0 2px 12px rgba(0,0,0,0.4);
--shadow-lg: 0 4px 24px rgba(0,0,0,0.6);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
font-size: 13px;
line-height: 1.5;
color: var(--text-primary);
}
html, body, #root {
height: 100%;
background: var(--bg-primary);
overflow: hidden;
}
/* ========== APP LAYOUT ========== */
.app {
display: flex;
flex-direction: column;
height: 100vh;
background: var(--bg-primary);
}
/* ========== TITLE BAR ========== */
.titlebar {
display: flex;
align-items: center;
justify-content: space-between;
height: 36px;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
padding: 0 8px 0 12px;
flex-shrink: 0;
user-select: none;
}
.titlebar-left {
display: flex;
align-items: center;
gap: 8px;
}
.app-logo {
color: var(--accent);
font-size: 14px;
}
.app-title {
font-weight: 600;
font-size: 13px;
color: var(--text-primary);
}
.active-badge {
background: var(--green);
color: #000;
font-size: 10px;
font-weight: 700;
padding: 1px 6px;
border-radius: 10px;
letter-spacing: 0.02em;
}
.titlebar-controls {
display: flex;
gap: 4px;
}
.tb-btn {
width: 28px;
height: 24px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 15px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.15s, color 0.15s;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
/* ========== TAB BAR ========== */
.tabbar {
display: flex;
align-items: center;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
padding: 0 8px;
height: 38px;
gap: 2px;
flex-shrink: 0;
}
.tab {
position: relative;
padding: 0 14px;
height: 30px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 12.5px;
font-weight: 500;
transition: background 0.15s, color 0.15s;
display: flex;
align-items: center;
gap: 6px;
white-space: nowrap;
}
.tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.tab.active {
background: var(--accent-dim);
color: var(--accent);
border: 1px solid rgba(79, 142, 247, 0.3);
}
.tab--icon { margin-left: 4px; font-size: 12px; }
.tab-badge {
background: var(--accent);
color: #fff;
font-size: 9px;
font-weight: 700;
padding: 1px 5px;
border-radius: 8px;
line-height: 1.4;
}
.tab-badge--green { background: var(--green); padding: 1px 3px; }
.tab-badge--red { background: var(--red); }
.tabbar-spacer { flex: 1; }
/* ========== CONTENT AREA ========== */
.content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 16px;
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
/* ========== STREAMS VIEW ========== */
.streams-view { min-height: 100%; }
.streams-grid {
display: flex;
flex-direction: column;
gap: 12px;
}
/* ========== ADD STREAM BUTTON ========== */
.add-stream-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
padding: 14px;
border: 2px dashed var(--border-bright);
background: transparent;
color: var(--text-muted);
border-radius: var(--radius);
cursor: pointer;
font-size: 13px;
font-weight: 500;
transition: all 0.2s;
}
.add-stream-btn:hover {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-dim);
}
.add-icon {
font-size: 20px;
font-weight: 300;
line-height: 1;
}
/* ========== STREAM CARD ========== */
.stream-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
overflow: hidden;
transition: border-color 0.2s, box-shadow 0.2s;
}
.stream-card:hover { border-color: var(--border-bright); }
.stream-card--active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green-dim); }
.stream-card.status--error { border-color: var(--red); }
/* Card Header */
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
gap: 8px;
}
.card-header-left {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
}
.card-header-right {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
}
/* Status dot */
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
background: var(--text-muted);
}
.status-dot.status--idle { background: var(--text-muted); }
.status-dot.status--connecting {
background: var(--orange);
animation: pulse 1s infinite;
}
.status-dot.status--running {
background: var(--green);
box-shadow: 0 0 6px var(--green);
}
.status-dot.status--error { background: var(--red); }
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
.stream-name {
font-weight: 600;
font-size: 13.5px;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.stream-name:hover { color: var(--accent); }
.name-input {
background: var(--bg-input);
border: 1px solid var(--border-focus);
color: var(--text-primary);
border-radius: var(--radius-sm);
padding: 2px 8px;
font-size: 13.5px;
font-weight: 600;
outline: none;
width: 180px;
}
.status-label {
font-size: 11px;
color: var(--text-muted);
flex-shrink: 0;
}
/* Card summary */
.card-summary {
padding: 8px 12px;
font-size: 12px;
color: var(--text-muted);
font-family: 'SF Mono', 'Consolas', monospace;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* ========== BUTTONS ========== */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 5px;
padding: 5px 12px;
border: none;
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.02em;
transition: all 0.15s;
white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--start {
background: var(--green);
color: #000;
}
.btn--start:hover:not(:disabled) {
background: #16a34a;
box-shadow: 0 0 10px rgba(34,197,94,0.4);
}
.btn--stop {
background: var(--red);
color: #fff;
}
.btn--stop:hover {
background: #dc2626;
box-shadow: 0 0 10px rgba(239,68,68,0.4);
}
.btn--icon {
width: 28px;
height: 28px;
padding: 0;
background: transparent;
border: 1px solid var(--border);
color: var(--text-secondary);
}
.btn--icon:hover { background: var(--bg-hover); border-color: var(--border-bright); color: var(--text-primary); }
.btn--danger:hover { border-color: var(--red); color: var(--red); }
.btn--small {
padding: 4px 10px;
background: var(--bg-hover);
color: var(--text-secondary);
border: 1px solid var(--border);
}
.btn--small:hover { color: var(--text-primary); border-color: var(--border-bright); }
/* ========== STREAM SETTINGS ========== */
.stream-settings {
padding: 12px;
}
.section-tabs {
display: flex;
gap: 4px;
margin-bottom: 12px;
border-bottom: 1px solid var(--border);
padding-bottom: 8px;
}
.section-tab {
padding: 4px 12px;
border: none;
background: transparent;
color: var(--text-muted);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 12px;
font-weight: 500;
transition: all 0.15s;
}
.section-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.section-tab.active {
background: var(--accent-dim);
color: var(--accent);
}
.settings-section { display: flex; flex-direction: column; gap: 12px; }
.settings-group {
background: var(--bg-section);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 12px;
}
.group-title {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
margin-bottom: 10px;
}
/* ========== FIELDS ========== */
.field {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 8px;
}
.field:last-child { margin-bottom: 0; }
.field-label {
font-size: 11.5px;
font-weight: 500;
color: var(--text-secondary);
}
.field-select,
.field-input {
background: var(--bg-input);
border: 1px solid var(--border);
color: var(--text-primary);
border-radius: var(--radius-sm);
padding: 6px 10px;
font-size: 12.5px;
outline: none;
transition: border-color 0.15s;
width: 100%;
appearance: none;
-webkit-appearance: none;
}
.field-select {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 8px center;
padding-right: 28px;
cursor: pointer;
}
.field-select:focus,
.field-input:focus {
border-color: var(--border-focus);
box-shadow: 0 0 0 2px rgba(79,142,247,0.15);
}
.field-select:disabled,
.field-input:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.field-input--small {
margin-top: 4px;
font-size: 12px;
}
.field-loading {
padding: 6px 10px;
color: var(--text-muted);
font-size: 12px;
font-style: italic;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
}
.fields-row {
display: flex;
gap: 8px;
margin-bottom: 8px;
}
.fields-row:last-child { margin-bottom: 0; }
.fields-row .field { margin-bottom: 0; }
.field--grow { flex: 1; }
.field--half { flex: 1; }
.field--port { width: 100px; flex-shrink: 0; }
.checkbox-label {
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
font-size: 12.5px;
color: var(--text-secondary);
user-select: none;
}
.checkbox-label input { cursor: pointer; accent-color: var(--accent); }
/* SRT URL Preview */
.srt-preview {
display: flex;
align-items: center;
gap: 8px;
margin-top: 8px;
padding: 6px 10px;
background: rgba(0,0,0,0.3);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
}
.srt-preview-label {
font-size: 11px;
color: var(--text-muted);
white-space: nowrap;
flex-shrink: 0;
}
.srt-url {
font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
font-size: 11px;
color: var(--text-code);
word-break: break-all;
}
/* ========== TOLBEK SETTINGS ========== */
.tolbek-settings {
max-width: 700px;
margin: 0 auto;
}
.section-header {
margin-bottom: 16px;
}
.section-title {
font-size: 16px;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 4px;
}
.section-desc {
font-size: 12.5px;
color: var(--text-muted);
}
.settings-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 16px;
display: flex;
flex-direction: column;
gap: 12px;
}
.tolbek-status {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.status-indicator {
display: flex;
align-items: center;
gap: 8px;
font-size: 12.5px;
}
.status-indicator.status--running { color: var(--green); }
.status-indicator.status--connecting { color: var(--orange); }
.status-indicator.status--error { color: var(--red); }
.status-indicator.status--idle { color: var(--text-muted); }
.tolbek-actions { display: flex; gap: 8px; }
.tolbek-log {
margin-top: 8px;
max-height: 120px;
overflow-y: auto;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 8px;
font-family: monospace;
font-size: 11px;
color: var(--text-secondary);
}
.info-text {
font-size: 12px;
color: var(--text-muted);
line-height: 1.6;
margin-bottom: 6px;
}
.info-text:last-child { margin-bottom: 0; }
.info-text strong { color: var(--text-secondary); }
.info-text em { color: var(--text-code); font-style: normal; }
/* Tolbek modes info */
.tolbek-modes-info {
display: flex;
flex-direction: column;
gap: 8px;
}
.mode-row {
display: flex;
gap: 10px;
align-items: flex-start;
font-size: 12px;
}
.mode-tag {
flex-shrink: 0;
width: 82px;
padding: 2px 8px;
border-radius: 4px;
font-size: 11px;
font-weight: 700;
text-align: center;
background: var(--accent-dim);
color: var(--accent);
border: 1px solid rgba(79,142,247,0.25);
}
.mode-desc {
color: var(--text-muted);
line-height: 1.5;
}
.mode-desc em { color: var(--text-code); font-style: normal; }
/* ========== LOG PANEL ========== */
.log-panel {
display: flex;
flex-direction: column;
height: calc(100vh - 74px - 32px);
}
.log-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border);
margin-bottom: 8px;
flex-shrink: 0;
flex-wrap: wrap;
}
.log-filters {
display: flex;
gap: 4px;
flex-wrap: wrap;
}
.filter-btn {
padding: 3px 10px;
border: 1px solid var(--border);
background: transparent;
color: var(--text-muted);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 11.5px;
transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }
.filter-btn.active {
background: var(--accent-dim);
border-color: var(--accent);
color: var(--accent);
}
.log-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.log-content {
flex: 1;
overflow-y: auto;
font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
font-size: 11px;
line-height: 1.5;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 8px;
}
.log-empty {
text-align: center;
color: var(--text-muted);
padding: 24px;
font-family: inherit;
}
.log-line {
display: flex;
gap: 6px;
padding: 1px 0;
word-break: break-all;
}
.log-line--error { color: var(--red); }
.log-stream {
color: var(--accent);
flex-shrink: 0;
font-size: 10px;
padding-top: 1px;
}
.log-text {
color: var(--text-secondary);
flex: 1;
}
.log-line--error .log-text { color: var(--red); }
/* ========== SCROLLBAR ========== */
* { scrollbar-width: thin; scrollbar-color: var(--border-bright) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
/* ========== SELECT OPTION STYLING ========== */
option { background: #1a1a2e; color: var(--text-primary); }
option:disabled { color: var(--text-muted); }