2026-05-22 10:04:23 -04:00
|
|
|
// visuals.jsx - reusable visual elements
|
2026-05-22 08:13:36 -04:00
|
|
|
|
2026-05-22 10:04:23 -04:00
|
|
|
const _thumbCache = new Map();
|
2026-05-22 08:13:36 -04:00
|
|
|
|
2026-05-22 10:04:23 -04:00
|
|
|
function AssetThumb({ asset, size = 'md' }) {
|
|
|
|
|
const aspect = size === 'tall' ? '9 / 16' : '16 / 9';
|
|
|
|
|
const [thumbUrl, setThumbUrl] = React.useState(_thumbCache.get(asset.id) || null);
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!asset.id || thumbUrl || !asset.thumbnail_s3_key) return;
|
|
|
|
|
let cancelled = false;
|
chore: 1.2 ship-prep sweep — close 38 issues
Frontend / UX / a11y
- Sidebar collapse/expand toggle with localStorage persistence (#142)
- Settings sections wrap inputs in <form> with Enter-to-submit + native
validation; password autocomplete=new-password (#141, #138)
- Asset thumbnails get descriptive alt text (#140)
- Production deploy now precompiles JSX via esbuild and loads the
production React UMD instead of dev builds + in-browser Babel (#139,
#122)
- Search wrapper gets role=search; global search input gets aria-label,
role=combobox, aria-controls/aria-expanded/aria-activedescendant
wiring (#137, #135)
- Dashboard and Library no longer share the same nav icon (#136)
- Sidebar collapses off-canvas with a topbar menu button below 768 px;
mobile default is collapsed (#134)
- --text-3 bumped to #8B92A0 for WCAG AA contrast on --bg-0 (#133)
- Schedule and Library routes were rendering empty inside the .main
flex container — switched to flex:1 + min-height:0 (#131, #132,
editor + asset detail get the same fix)
- Jobs nav badge now polls /jobs?status=active every 10 s and reflects
the live count (#130, #113)
- aria-label sweep on every icon-only button (#126)
- Premiere panel release list moved to window.PREMIERE_RELEASES in
data.jsx; Editor + Settings read from the same source (#125)
- Typo setPgMclips → setPgmClips (#124)
- Stray console.error / console.warn calls gated behind
window.DF_LOG.{warn,error} (#123)
- Hardcoded /api/v1 paths route through window.ZAMPP_API_PREFIX (#115)
- Schedule rows no longer crash on null recorder_id (#117)
- EditorKeyboard guards against document.activeElement === null (#116)
- Unmount-safe timers for PasswordResetModal, Containers, Editor (#111)
- Player seek clamps below totalMs, server-side range clamping +
uncached 416 on EOF, client-side EOF-stall watchdog (#143)
- Duration badge overlap fix on narrow asset cards (#52)
Backend / security / reliability
- GET /recorders fixed N+1: single LATERAL JOIN for live_asset_id;
Docker inspects bounded to actually-recording rows (#121)
- Upload disk-storage (multer.diskStorage) streams parts to S3 instead
of buffering 500 MB in RAM (#120)
- /assets list clamps limit to MAX_LIMIT=500 to prevent OOM (#119)
- SDK upload archive listing + post-extract sanitize block zip-slip /
tar-slip and symlink escapes (#118)
- Migrations track applied state in schema_migrations, run in a
transaction, and exit non-zero on failure (#107)
- node-agent BMD_COUNT override uses BMD_DEVICE_PREFIX; filesystem
detection wins (#109, #127)
- GPU_COUNT override now merges with nvidia-smi enrichment (#108)
- /cluster/heartbeat requires a node-bound token or admin user;
tokens carry bound_hostname (#106)
- /recorders/:id/start error responses no longer echo the Docker
create payload — env vars stay out of client responses (#105)
- /recorders/probe restricts schemes (srt/rtmp/rtsp/udp/rtp), blocks
private + loopback hosts for non-admins, denies common service
ports (#104)
- Scheduler tick guarded by a Postgres advisory lock; pending/running
rows claimed via UPDATE...RETURNING + FOR UPDATE SKIP LOCKED to
survive multi-node deploys (#103)
- UUID validateUuid('id') param middleware on every /:id route (#102)
- Error handler scrubs Postgres error messages and 5xx detail (#101)
- Graceful SIGTERM/SIGINT shutdown — stops scheduler, drains the HTTP
server, ends the pool, 25 s force-exit watchdog (#100)
- AMPP sync moved from fire-and-forget to a persisted retry queue
(ampp_sync_status / attempts / next_attempt_at + scheduler retry
loop with exponential backoff) (#77)
Migrations
- 019: api_tokens.bound_hostname (#106)
- 020: assets.ampp_sync_status + retry bookkeeping (#77)
Other
- Defer #92 Growing-files per-upload toggle, #80 Audio tab, #57
Dashboard redesign, #56 Editor SPA polish phase 3, #114 S3
migration tool to v1.3
2026-05-26 22:06:14 -04:00
|
|
|
fetch((window.ZAMPP_API_PREFIX || '/api/v1') + '/assets/' + asset.id + '/thumbnail', { credentials: 'include' })
|
2026-05-22 10:04:23 -04:00
|
|
|
.then(r => r.ok ? r.json() : null)
|
|
|
|
|
.then(d => { if (!cancelled && d && d.url) { _thumbCache.set(asset.id, d.url); setThumbUrl(d.url); } })
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
return () => { cancelled = true; };
|
|
|
|
|
}, [asset.id, asset.thumbnail_s3_key]);
|
|
|
|
|
|
|
|
|
|
if (asset.type === 'audio' || asset.media_type === 'audio') {
|
2026-05-22 08:13:36 -04:00
|
|
|
return (
|
|
|
|
|
<div className="asset-thumb audio" style={{ aspectRatio: aspect }}>
|
2026-05-22 10:04:23 -04:00
|
|
|
<Waveform seed={asset.id ? asset.id.charCodeAt(0) % 60 : 1} />
|
|
|
|
|
<div className="thumb-overlay"><Icon name="audio" size={20} style={{ opacity: 0.9 }} /></div>
|
2026-05-22 08:13:36 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
chore: 1.2 ship-prep sweep — close 38 issues
Frontend / UX / a11y
- Sidebar collapse/expand toggle with localStorage persistence (#142)
- Settings sections wrap inputs in <form> with Enter-to-submit + native
validation; password autocomplete=new-password (#141, #138)
- Asset thumbnails get descriptive alt text (#140)
- Production deploy now precompiles JSX via esbuild and loads the
production React UMD instead of dev builds + in-browser Babel (#139,
#122)
- Search wrapper gets role=search; global search input gets aria-label,
role=combobox, aria-controls/aria-expanded/aria-activedescendant
wiring (#137, #135)
- Dashboard and Library no longer share the same nav icon (#136)
- Sidebar collapses off-canvas with a topbar menu button below 768 px;
mobile default is collapsed (#134)
- --text-3 bumped to #8B92A0 for WCAG AA contrast on --bg-0 (#133)
- Schedule and Library routes were rendering empty inside the .main
flex container — switched to flex:1 + min-height:0 (#131, #132,
editor + asset detail get the same fix)
- Jobs nav badge now polls /jobs?status=active every 10 s and reflects
the live count (#130, #113)
- aria-label sweep on every icon-only button (#126)
- Premiere panel release list moved to window.PREMIERE_RELEASES in
data.jsx; Editor + Settings read from the same source (#125)
- Typo setPgMclips → setPgmClips (#124)
- Stray console.error / console.warn calls gated behind
window.DF_LOG.{warn,error} (#123)
- Hardcoded /api/v1 paths route through window.ZAMPP_API_PREFIX (#115)
- Schedule rows no longer crash on null recorder_id (#117)
- EditorKeyboard guards against document.activeElement === null (#116)
- Unmount-safe timers for PasswordResetModal, Containers, Editor (#111)
- Player seek clamps below totalMs, server-side range clamping +
uncached 416 on EOF, client-side EOF-stall watchdog (#143)
- Duration badge overlap fix on narrow asset cards (#52)
Backend / security / reliability
- GET /recorders fixed N+1: single LATERAL JOIN for live_asset_id;
Docker inspects bounded to actually-recording rows (#121)
- Upload disk-storage (multer.diskStorage) streams parts to S3 instead
of buffering 500 MB in RAM (#120)
- /assets list clamps limit to MAX_LIMIT=500 to prevent OOM (#119)
- SDK upload archive listing + post-extract sanitize block zip-slip /
tar-slip and symlink escapes (#118)
- Migrations track applied state in schema_migrations, run in a
transaction, and exit non-zero on failure (#107)
- node-agent BMD_COUNT override uses BMD_DEVICE_PREFIX; filesystem
detection wins (#109, #127)
- GPU_COUNT override now merges with nvidia-smi enrichment (#108)
- /cluster/heartbeat requires a node-bound token or admin user;
tokens carry bound_hostname (#106)
- /recorders/:id/start error responses no longer echo the Docker
create payload — env vars stay out of client responses (#105)
- /recorders/probe restricts schemes (srt/rtmp/rtsp/udp/rtp), blocks
private + loopback hosts for non-admins, denies common service
ports (#104)
- Scheduler tick guarded by a Postgres advisory lock; pending/running
rows claimed via UPDATE...RETURNING + FOR UPDATE SKIP LOCKED to
survive multi-node deploys (#103)
- UUID validateUuid('id') param middleware on every /:id route (#102)
- Error handler scrubs Postgres error messages and 5xx detail (#101)
- Graceful SIGTERM/SIGINT shutdown — stops scheduler, drains the HTTP
server, ends the pool, 25 s force-exit watchdog (#100)
- AMPP sync moved from fire-and-forget to a persisted retry queue
(ampp_sync_status / attempts / next_attempt_at + scheduler retry
loop with exponential backoff) (#77)
Migrations
- 019: api_tokens.bound_hostname (#106)
- 020: assets.ampp_sync_status + retry bookkeeping (#77)
Other
- Defer #92 Growing-files per-upload toggle, #80 Audio tab, #57
Dashboard redesign, #56 Editor SPA polish phase 3, #114 S3
migration tool to v1.3
2026-05-26 22:06:14 -04:00
|
|
|
const altText = asset.name ? `Thumbnail for ${asset.name}` : 'Asset thumbnail';
|
2026-05-22 08:13:36 -04:00
|
|
|
return (
|
2026-05-22 10:04:23 -04:00
|
|
|
<div className="asset-thumb" style={{ background: 'var(--bg-2)', aspectRatio: aspect, overflow: 'hidden', position: 'relative' }}>
|
|
|
|
|
{thumbUrl
|
chore: 1.2 ship-prep sweep — close 38 issues
Frontend / UX / a11y
- Sidebar collapse/expand toggle with localStorage persistence (#142)
- Settings sections wrap inputs in <form> with Enter-to-submit + native
validation; password autocomplete=new-password (#141, #138)
- Asset thumbnails get descriptive alt text (#140)
- Production deploy now precompiles JSX via esbuild and loads the
production React UMD instead of dev builds + in-browser Babel (#139,
#122)
- Search wrapper gets role=search; global search input gets aria-label,
role=combobox, aria-controls/aria-expanded/aria-activedescendant
wiring (#137, #135)
- Dashboard and Library no longer share the same nav icon (#136)
- Sidebar collapses off-canvas with a topbar menu button below 768 px;
mobile default is collapsed (#134)
- --text-3 bumped to #8B92A0 for WCAG AA contrast on --bg-0 (#133)
- Schedule and Library routes were rendering empty inside the .main
flex container — switched to flex:1 + min-height:0 (#131, #132,
editor + asset detail get the same fix)
- Jobs nav badge now polls /jobs?status=active every 10 s and reflects
the live count (#130, #113)
- aria-label sweep on every icon-only button (#126)
- Premiere panel release list moved to window.PREMIERE_RELEASES in
data.jsx; Editor + Settings read from the same source (#125)
- Typo setPgMclips → setPgmClips (#124)
- Stray console.error / console.warn calls gated behind
window.DF_LOG.{warn,error} (#123)
- Hardcoded /api/v1 paths route through window.ZAMPP_API_PREFIX (#115)
- Schedule rows no longer crash on null recorder_id (#117)
- EditorKeyboard guards against document.activeElement === null (#116)
- Unmount-safe timers for PasswordResetModal, Containers, Editor (#111)
- Player seek clamps below totalMs, server-side range clamping +
uncached 416 on EOF, client-side EOF-stall watchdog (#143)
- Duration badge overlap fix on narrow asset cards (#52)
Backend / security / reliability
- GET /recorders fixed N+1: single LATERAL JOIN for live_asset_id;
Docker inspects bounded to actually-recording rows (#121)
- Upload disk-storage (multer.diskStorage) streams parts to S3 instead
of buffering 500 MB in RAM (#120)
- /assets list clamps limit to MAX_LIMIT=500 to prevent OOM (#119)
- SDK upload archive listing + post-extract sanitize block zip-slip /
tar-slip and symlink escapes (#118)
- Migrations track applied state in schema_migrations, run in a
transaction, and exit non-zero on failure (#107)
- node-agent BMD_COUNT override uses BMD_DEVICE_PREFIX; filesystem
detection wins (#109, #127)
- GPU_COUNT override now merges with nvidia-smi enrichment (#108)
- /cluster/heartbeat requires a node-bound token or admin user;
tokens carry bound_hostname (#106)
- /recorders/:id/start error responses no longer echo the Docker
create payload — env vars stay out of client responses (#105)
- /recorders/probe restricts schemes (srt/rtmp/rtsp/udp/rtp), blocks
private + loopback hosts for non-admins, denies common service
ports (#104)
- Scheduler tick guarded by a Postgres advisory lock; pending/running
rows claimed via UPDATE...RETURNING + FOR UPDATE SKIP LOCKED to
survive multi-node deploys (#103)
- UUID validateUuid('id') param middleware on every /:id route (#102)
- Error handler scrubs Postgres error messages and 5xx detail (#101)
- Graceful SIGTERM/SIGINT shutdown — stops scheduler, drains the HTTP
server, ends the pool, 25 s force-exit watchdog (#100)
- AMPP sync moved from fire-and-forget to a persisted retry queue
(ampp_sync_status / attempts / next_attempt_at + scheduler retry
loop with exponential backoff) (#77)
Migrations
- 019: api_tokens.bound_hostname (#106)
- 020: assets.ampp_sync_status + retry bookkeeping (#77)
Other
- Defer #92 Growing-files per-upload toggle, #80 Audio tab, #57
Dashboard redesign, #56 Editor SPA polish phase 3, #114 S3
migration tool to v1.3
2026-05-26 22:06:14 -04:00
|
|
|
? <img src={thumbUrl} alt={altText} style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
|
2026-05-22 10:04:23 -04:00
|
|
|
: <FauxFrame />}
|
|
|
|
|
{asset.status === 'live' && (
|
|
|
|
|
<div style={{ position: 'absolute', inset: 0, border: '2px solid var(--live)', pointerEvents: 'none' }} />
|
|
|
|
|
)}
|
2026-05-22 08:13:36 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function FauxFrame({ seed }) {
|
2026-05-22 10:04:23 -04:00
|
|
|
return <div className="thumb-svg" style={{ background: 'var(--bg-1)' }} />;
|
2026-05-22 08:13:36 -04:00
|
|
|
}
|
|
|
|
|
|
2026-05-22 10:04:23 -04:00
|
|
|
function Waveform({ seed = 1, color = 'var(--accent)', className = '' }) {
|
2026-05-22 08:13:36 -04:00
|
|
|
const bars = 60;
|
|
|
|
|
const pts = React.useMemo(() => {
|
|
|
|
|
return Array.from({ length: bars }).map((_, i) => {
|
|
|
|
|
const n = Math.sin(i * 0.7 + seed) * 0.5 + Math.sin(i * 2.1 + seed * 1.3) * 0.3 + Math.sin(i * 4.3 + seed * 0.7) * 0.2;
|
|
|
|
|
return Math.max(0.1, Math.min(1, 0.5 + n * 0.5));
|
|
|
|
|
});
|
|
|
|
|
}, [seed]);
|
|
|
|
|
return (
|
2026-05-22 10:04:23 -04:00
|
|
|
<svg viewBox="0 0 60 20" preserveAspectRatio="none" className={'waveform ' + className}>
|
2026-05-22 08:13:36 -04:00
|
|
|
{pts.map((p, i) => (
|
|
|
|
|
<rect key={i} x={i} y={10 - p * 9} width="0.6" height={p * 18} fill={color} rx="0.3" />
|
|
|
|
|
))}
|
|
|
|
|
</svg>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function LiveStrip({ seed = 1, count = 8 }) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="live-strip">
|
|
|
|
|
{Array.from({ length: count }).map((_, i) => (
|
2026-05-22 10:04:23 -04:00
|
|
|
<div key={i} className="live-strip-cell" style={{ background: 'var(--bg-1)' }} />
|
2026-05-22 08:13:36 -04:00
|
|
|
))}
|
2026-05-22 10:04:23 -04:00
|
|
|
<div className="live-strip-now"><span className="live-pulse" />NOW</div>
|
2026-05-22 08:13:36 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 10:04:23 -04:00
|
|
|
function Sparkline({ data, color = 'var(--accent)', height = 28, fill = true }) {
|
2026-05-22 08:13:36 -04:00
|
|
|
const max = Math.max(...data, 1);
|
|
|
|
|
const min = Math.min(...data, 0);
|
|
|
|
|
const range = max - min || 1;
|
|
|
|
|
const w = 100;
|
|
|
|
|
const pts = data.map((d, i) => {
|
|
|
|
|
const x = (i / (data.length - 1)) * w;
|
|
|
|
|
const y = height - ((d - min) / range) * height;
|
2026-05-22 10:04:23 -04:00
|
|
|
return x + ',' + y;
|
|
|
|
|
}).join(' ');
|
|
|
|
|
const area = '0,' + height + ' ' + pts + ' ' + w + ',' + height;
|
2026-05-22 08:13:36 -04:00
|
|
|
return (
|
2026-05-22 10:04:23 -04:00
|
|
|
<svg viewBox={'0 0 ' + w + ' ' + height} preserveAspectRatio="none" style={{ width: '100%', height, display: 'block' }}>
|
2026-05-22 08:13:36 -04:00
|
|
|
{fill && <polygon points={area} fill={color} opacity="0.15" />}
|
|
|
|
|
<polyline points={pts} fill="none" stroke={color} strokeWidth="1.5" />
|
|
|
|
|
</svg>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AudioMeter({ level = 0.7, peak = 0.85, vertical = false }) {
|
|
|
|
|
const segs = 20;
|
|
|
|
|
return (
|
2026-05-22 10:04:23 -04:00
|
|
|
<div className={'audio-meter ' + (vertical ? 'v' : 'h')}>
|
2026-05-22 08:13:36 -04:00
|
|
|
{Array.from({ length: segs }).map((_, i) => {
|
|
|
|
|
const v = i / segs;
|
|
|
|
|
const on = v < level;
|
2026-05-22 10:04:23 -04:00
|
|
|
const color = v < 0.6 ? 'var(--success)' : v < 0.85 ? 'var(--warning)' : 'var(--danger)';
|
|
|
|
|
return <div key={i} className="audio-seg" style={{ background: on ? color : 'var(--bg-3)', opacity: on ? 1 : 0.4 }} />;
|
2026-05-22 08:13:36 -04:00
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function StatusDot({ status }) {
|
|
|
|
|
const map = {
|
2026-05-22 10:04:23 -04:00
|
|
|
online: { color: 'var(--success)', pulse: false },
|
|
|
|
|
recording: { color: 'var(--live)', pulse: true },
|
|
|
|
|
armed: { color: 'var(--accent)', pulse: false },
|
|
|
|
|
idle: { color: 'var(--text-4)', pulse: false },
|
|
|
|
|
error: { color: 'var(--danger)', pulse: true },
|
|
|
|
|
offline: { color: 'var(--text-4)', pulse: false },
|
|
|
|
|
processing: { color: 'var(--warning)', pulse: true },
|
|
|
|
|
ready: { color: 'var(--success)', pulse: false },
|
|
|
|
|
live: { color: 'var(--live)', pulse: true },
|
|
|
|
|
queued: { color: 'var(--text-3)', pulse: false },
|
|
|
|
|
running: { color: 'var(--accent)', pulse: true },
|
|
|
|
|
done: { color: 'var(--success)', pulse: false },
|
|
|
|
|
failed: { color: 'var(--danger)', pulse: false },
|
|
|
|
|
stopped: { color: 'var(--text-4)', pulse: false },
|
2026-05-22 08:13:36 -04:00
|
|
|
};
|
2026-05-22 10:04:23 -04:00
|
|
|
const s = map[status] || { color: 'var(--text-3)' };
|
|
|
|
|
return <span className={'status-dot ' + (s.pulse ? 'pulse' : '')} style={{ background: s.color, boxShadow: '0 0 0 3px ' + s.color + '30' }} />;
|
2026-05-22 08:13:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Elapsed({ seconds, live = false }) {
|
|
|
|
|
const [t, setT] = React.useState(seconds);
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (!live) return;
|
|
|
|
|
const i = setInterval(() => setT(x => x + 1), 1000);
|
|
|
|
|
return () => clearInterval(i);
|
|
|
|
|
}, [live]);
|
|
|
|
|
const h = Math.floor(t / 3600);
|
|
|
|
|
const m = Math.floor((t % 3600) / 60);
|
|
|
|
|
const s = t % 60;
|
2026-05-22 10:04:23 -04:00
|
|
|
return <span className="mono">{String(h).padStart(2,'0')}:{String(m).padStart(2,'0')}:{String(s).padStart(2,'0')}</span>;
|
2026-05-22 08:13:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.assign(window, { AssetThumb, FauxFrame, Waveform, LiveStrip, Sparkline, AudioMeter, StatusDot, Elapsed });
|