Adds host/process RAM metrics and stream retention/prune telemetry to the admin debug dashboard so lag can be correlated with memory and segment buildup in real time. Includes minor formatting-only cleanups in touched UI/subtitle files without behavioural change.
Adds copy buttons to each debug dashboard sub-panel so admins can quickly export diagnostics for troubleshooting. Users and storage export as JSON; stream/cache and orphaned output panels export as CSV for easy sharing and analysis.
Adds periodic cleanup of temporary HLS stream output directories whenever no viewers are active, alongside startup cleanup. This prevents stale segment folders from lingering after crashes or interrupted sessions and improves long-run streaming stability and memory/disk hygiene.
Adds an admin-only Debug menu action in the top bar with a live dashboard for signed-in users, root usage, active stream footprint, and subtitle cache usage per video. The payload now includes videos that still have cached data even when nobody is watching. This helps monitor stream cleanup behaviour and detect lingering cache/segment data during sequential playback sessions.
- Subtitle event cache TTL now refreshes on every access, preventing
the entire subtitle track being re-parsed every 5 minutes during
active playback. Previously, watching a film with PGS subtitles for
longer than 5 minutes would silently re-decode all subtitle frames
from scratch, causing periodic CPU spikes and visible lag.
- clearCachesForFile now deletes the corresponding .sup file from disk
when it evicts an event cache entry, instead of only clearing the
in-memory cache. Without this, one .sup file was left on disk
permanently for every unique video+subtitle-stream combination ever
watched.
- purgeSubtitleCacheDir is called once at server startup to remove any
.sup files left over from a previous run, so the on-disk footprint is
always bounded to the current session.
- clearCachesForFile now maintains separate key lists for the event and
frame caches instead of one shared list, making the intent clear and
avoiding redundant no-op lookups.
- Removed dead code clearImageSubtitleCachesForSession from
video-stream.js (defined but never called).
- Updated image-subtitles tests to match the actual render scale (0.75)
and added coverage for purgeSubtitleCacheDir and the guarantee that
subtitle caches are cleared when a session's last stream is closed.
Previously, the server rendered image subtitles but threw away all positioning
metadata, sending only the PNG buffer. The client had no way to know the
actual frame dimensions or position within the rendered canvas, so it relied
on CSS max-height constraints (which didn't scale properly for downscaled frames).
Now the server:
1. Preserves positioning metadata (left, top, width, height, canvasWidth, canvasHeight)
2. Returns frame data as an object with both the PNG buffer and metadata
3. Sends headers with the placement information
The client:
1. Reads X-Subtitle-Frame-* headers from the response
2. Calculates percentage-based positioning: (frameLeft / canvasWidth) * 100%
3. Calculates percentage-based sizing: (frameWidth / canvasWidth) * 100%
4. Applies these values to properly position and scale the image
This allows downscaled subtitle frames (rendered at 0.5 scale) to:
- Display at correct size relative to the canvas they were rendered for
- Scale properly in both normal and fullscreen modes
- Maintain proper aspect ratio and positioning
Fixes the subtitle display issue where downscaled frames appeared too small
and fell off screen edges in fullscreen mode.