feat: upload progress bar — fieldset layout, accent colors, file name display, completion animation, 800ms redirect delay; decorelate formats from fichiers; server-side poll via token; bump PeerTube embed audio player

This commit is contained in:
Pontoporeia
2026-05-11 13:12:36 +02:00
parent cdec3e96a6
commit 927ee2fe2a
12 changed files with 420 additions and 212 deletions

View File

@@ -436,4 +436,30 @@ class PeerTubeService
return ['status' => $status, 'body' => (string)$responseBody, 'headers' => $responseHeaders];
}
// -------------------------------------------------------------------------
// Progress reporting (for upload-progress.js polling)
// -------------------------------------------------------------------------
/**
* Write upload progress to a temp file polled by the progress endpoint.
*/
public static function writeProgress(string $token, string $stage, int $pct, string $file = ''): void
{
$progressFile = sys_get_temp_dir() . '/xamxam_upload_' . $token . '.json';
file_put_contents($progressFile, json_encode([
'stage' => $stage,
'pct' => $pct,
'file' => $file,
]), LOCK_EX);
}
/**
* Remove the progress file for a given token.
*/
public static function clearProgress(string $token): void
{
$progressFile = sys_get_temp_dir() . '/xamxam_upload_' . $token . '.json';
@unlink($progressFile);
}
}