mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-11-09 11:10:08 +01: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:
1 parent
cdec3e96a6
commit
927ee2fe2a
12 files changed
+420
-212
No files matched your search
@@ -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