mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user