Fix stream progress to use bytes sent instead of range offset probes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jos Vooges | STH 2026-08-29 01:45:50 +02:00
parent 359a3c6883
commit f1b6923287
2 changed files with 4 additions and 3 deletions

View file

@ -85,7 +85,7 @@ export default function StreamsPage() {
<div className="card" style={{ marginBottom: "1rem" }}>
<p className="muted" style={{ margin: 0 }}>
Eén rij per kijker + titel. Alleen echte streams (&gt;512 KB). Stopt iemand → verdwijnt
binnen ~3 minuten. Voortgang is een schatting op range-positie.
binnen ~3 minuten. Voortgang ≈ gestreamde bytes / bestandsgrootte.
</p>
</div>

View file

@ -298,9 +298,10 @@ export async function registerAdminRoutes(app: FastifyInstance, config: Config)
.sort((a, b) => b.lastActivity.getTime() - a.lastActivity.getTime())
.map((s) => {
const fileSize = Number(s.fileSizeBytes || s.mediaFile.sizeBytes || 0);
const offset = Number(s.lastByteOffset || 0);
const sent = Number(s.bytesSent || 0);
// bytesSent loopt netjes op; lastByteOffset springt vaak naar EOF door player Range-probes.
const progressPercent =
fileSize > 0 ? Math.min(100, Math.max(0, (offset / fileSize) * 100)) : null;
fileSize > 0 ? Math.min(100, Math.max(0, (sent / fileSize) * 100)) : null;
const title =
s.mediaFile.movie?.title ??
(s.mediaFile.episode