diff --git a/TODO.md b/TODO.md index 3c2ef2b..199056d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,14 @@ -# FilePond Server-ID Refactor +# FilePond Refactor — Merge video/audio into TFE pool + +- [x] A. `fichiers-fragment.php` — Remove separate video/audio pools, merge into TFE; include PeerTube in data-existing-files +- [x] B. `file-upload-filepond.js` — Remove peertube_video/peertube_audio/video/audio from QUEUE_CONFIG, remove acceptedFileTypesPeerTube, remove data-peertube-active logic +- [x] C. `process.php` — When queue_type=tfe and video/audio + PeerTube enabled, upload to PeerTube, return peertube:UUID +- [x] D. `load.php` — Handle peertube DB files: return placeholder SVG blob +- [x] E. `form.php` — Include PeerTube files in existingFilesJsonForTfe for edit mode +- [x] F. `ThesisEditController.php` — Remove separate video/audio/peertube_* handleFilePondQueueFiles calls; also legacy $_FILES path +- [x] G. `ThesisCreateController.php` — Same as F + +## Previous items - [x] Step 1 — Build 4 PHP endpoints (process.php, revert.php, load.php, remove.php) - [x] Step 2 — Update ThesisFileHandler to accept file_ids instead of $_FILES diff --git a/app/public/admin/actions/filepond/load.php b/app/public/admin/actions/filepond/load.php index b8a695a..e9eddcb 100644 --- a/app/public/admin/actions/filepond/load.php +++ b/app/public/admin/actions/filepond/load.php @@ -45,10 +45,19 @@ $filePath = $fileRow['file_path'] ?? ''; $fileName = $fileRow['file_name'] ?? basename($filePath); $mimeType = $fileRow['mime_type'] ?? 'application/octet-stream'; -// ── Skip PeerTube and website entries (no actual file) ─────────────────── +// ── PeerTube entries: return a placeholder SVG blob so FilePond can display them ─┐ if (str_starts_with($filePath, 'peertube_ids:')) { - http_response_code(404); - die('Fichier PeerTube — pas de flux direct.'); + $uuid = substr($filePath, strlen('peertube_ids:')); + $isVideo = ($fileRow['file_type'] ?? '') === 'video'; + $svg = $isVideo + ? 'PeerTube ' . htmlspecialchars($uuid) . '' + : 'PeerTube ' . htmlspecialchars($uuid) . ''; + header('Content-Type: image/svg+xml'); + header('Content-Length: ' . strlen($svg)); + header('Content-Disposition: inline; filename="peertube.svg"'); + header('Cache-Control: no-cache'); + echo $svg; + exit; } if (str_starts_with($filePath, 'http://') || str_starts_with($filePath, 'https://')) { http_response_code(404); diff --git a/app/public/admin/actions/filepond/process.php b/app/public/admin/actions/filepond/process.php index 79a19d6..8dd065c 100644 --- a/app/public/admin/actions/filepond/process.php +++ b/app/public/admin/actions/filepond/process.php @@ -209,11 +209,14 @@ chmod($targetPath, 0644); error_log('[filepond:process] File saved to tmp | file_id=' . $fileId . ' | path=' . $targetPath); // ── PeerTube: upload immediately (don't wait for form submit) ──────────── -$isPeerTube = str_starts_with($queueType, 'peertube_'); -if ($isPeerTube) { +// Handles both dedicated peertube_* queues (legacy) and video/audio in the TFE pool +$isPeerTubeQueue = str_starts_with($queueType, 'peertube_'); +$isTfeAv = ($queueType === 'tfe' && preg_match('/^(video|audio)\//', $mimeType)); +$shouldPeerTube = $isPeerTubeQueue || $isTfeAv; +if ($shouldPeerTube) { require_once APP_ROOT . '/src/PeerTubeService.php'; if (PeerTubeService::isEnabled(new Database())) { - $ptFileType = ($queueType === 'peertube_video') ? 'video' : 'audio'; + $ptFileType = preg_match('/^video\//', $mimeType) ? 'video' : 'audio'; try { $result = PeerTubeService::upload( new Database(), @@ -223,7 +226,8 @@ if ($isPeerTube) { '' ); // Return a special ID prefix so the controller knows not to look in tmp/ - $fileId = 'peertube:' . $result['uuid']; + // Format: peertube:video:UUID or peertube:audio:UUID + $fileId = 'peertube:' . $ptFileType . ':' . $result['uuid']; // Clean up temp file — PeerTube has its own copy now @unlink($targetPath); @rmdir($tmpDir); @@ -239,11 +243,14 @@ if ($isPeerTube) { die('Erreur lors du téléversement vers PeerTube.'); } } else { - // PeerTube not enabled — reject the upload - @unlink($targetPath); - @rmdir($tmpDir); - http_response_code(503); - die('PeerTube n\'est pas activé.'); + // PeerTube not enabled — save to disk normally (only for tfe pool, not dedicated peertube queues) + if ($isPeerTubeQueue) { + @unlink($targetPath); + @rmdir($tmpDir); + http_response_code(503); + die('PeerTube n\'est pas activé.'); + } + // For TFE pool, fall through to normal disk save below } } diff --git a/app/public/admin/actions/filepond/revert.php b/app/public/admin/actions/filepond/revert.php index 28350e2..94a1f07 100644 --- a/app/public/admin/actions/filepond/revert.php +++ b/app/public/admin/actions/filepond/revert.php @@ -31,6 +31,7 @@ if ($_SERVER['REQUEST_METHOD'] !== 'DELETE') { $fileId = trim(file_get_contents('php://input')); // PeerTube files have a special prefix; nothing to clean up locally +// Format: peertube:video:UUID or peertube:audio:UUID if (str_starts_with($fileId, 'peertube:')) { // PeerTube files are already uploaded; we don't delete them from PeerTube on revert // (the user might still submit and associate them) diff --git a/app/public/assets/js/app/file-upload-filepond.js b/app/public/assets/js/app/file-upload-filepond.js index 5c2ad3b..bb59ecf 100644 --- a/app/public/assets/js/app/file-upload-filepond.js +++ b/app/public/assets/js/app/file-upload-filepond.js @@ -33,16 +33,8 @@ "text/vtt", "application/zip", "application/x-tar", "application/gzip" ], - // When PeerTube is active, exclude video/audio from TFE pool - acceptedFileTypesPeerTube: [ - "image/jpeg", "image/png", "image/gif", "image/webp", - "application/pdf", - "text/vtt", - "application/zip", "application/x-tar", "application/gzip" - ], labelFileTypeNotAllowed: "Format non accepté", fileValidateTypeLabelExpectedTypes: "PDF, Images, Vidéos, Audio, VTT, Archives", - fileValidateTypeLabelExpectedTypesPeerTube: "PDF, Images, VTT, Archives", maxFileSize: "500MB", labelMaxFileSizeExceeded: "Fichier trop volumineux", labelMaxFileSize: "Taille max: {filesize}", @@ -54,24 +46,6 @@ mp3: "2GB", ogg: "2GB", oga: "2GB", wav: "2GB", flac: "2GB", aac: "2GB", m4a: "2GB" } }, - video: { - acceptedFileTypes: ["video/mp4", "video/webm", "video/ogg", "video/quicktime"], - labelFileTypeNotAllowed: "Format non accepté", - fileValidateTypeLabelExpectedTypes: "MP4, WebM, OGV, MOV", - maxFileSize: "500MB", - labelMaxFileSizeExceeded: "Fichier trop volumineux", - labelMaxFileSize: "Taille max: {filesize}", - allowMultiple: true - }, - audio: { - acceptedFileTypes: ["audio/mpeg", "audio/ogg", "audio/flac", "audio/x-wav", "audio/aac", "audio/mp4"], - labelFileTypeNotAllowed: "Format non accepté", - fileValidateTypeLabelExpectedTypes: "MP3, OGG, FLAC, WAV, AAC, M4A", - maxFileSize: "500MB", - labelMaxFileSizeExceeded: "Fichier trop volumineux", - labelMaxFileSize: "Taille max: {filesize}", - allowMultiple: true - }, annexe: { acceptedFileTypes: ["application/pdf", "application/zip", "application/x-tar", "application/gzip"], labelFileTypeNotAllowed: "Format non accepté", @@ -99,24 +73,6 @@ labelMaxFileSize: "Taille max: {filesize}", allowMultiple: false }, - peertube_video: { - acceptedFileTypes: ["video/mp4", "video/webm", "video/ogg", "video/quicktime"], - labelFileTypeNotAllowed: "Format non accepté", - fileValidateTypeLabelExpectedTypes: "MP4, WebM, OGV, MOV", - maxFileSize: "500MB", - labelMaxFileSizeExceeded: "Fichier trop volumineux", - labelMaxFileSize: "Taille max: {filesize}", - allowMultiple: true - }, - peertube_audio: { - acceptedFileTypes: ["audio/mpeg", "audio/ogg", "audio/flac", "audio/x-wav", "audio/aac", "audio/mp4"], - labelFileTypeNotAllowed: "Format non accepté", - fileValidateTypeLabelExpectedTypes: "MP3, OGG, FLAC, WAV, AAC, M4A", - maxFileSize: "500MB", - labelMaxFileSizeExceeded: "Fichier trop volumineux", - labelMaxFileSize: "Taille max: {filesize}", - allowMultiple: true - }, }; // ── Helpers ─────────────────────────────────────────────────────────── @@ -270,15 +226,6 @@ // Per-type max size overrides (for TFE: PDF=100MB, video/audio=2GB) var perExtMax = cfg.perExtensionMaxSize || {}; - // When PeerTube is active, restrict TFE pool to PDF/text only - var peerTubeActive = queueType === "tfe" && input.dataset.peertubeActive === "1"; - var acceptedFileTypes = peerTubeActive && cfg.acceptedFileTypesPeerTube - ? cfg.acceptedFileTypesPeerTube - : cfg.acceptedFileTypes; - var expectedTypesLabel = peerTubeActive && cfg.fileValidateTypeLabelExpectedTypesPeerTube - ? cfg.fileValidateTypeLabelExpectedTypesPeerTube - : cfg.fileValidateTypeLabelExpectedTypes; - return { allowMultiple: cfg.allowMultiple, allowReorder: true, @@ -287,9 +234,9 @@ server: buildServerConfig(queueType), // ── Native FilePond validation ── - acceptedFileTypes: acceptedFileTypes, + acceptedFileTypes: cfg.acceptedFileTypes, labelFileTypeNotAllowed: cfg.labelFileTypeNotAllowed, - fileValidateTypeLabelExpectedTypes: expectedTypesLabel, + fileValidateTypeLabelExpectedTypes: cfg.fileValidateTypeLabelExpectedTypes, maxFileSize: cfg.maxFileSize, labelMaxFileSizeExceeded: cfg.labelMaxFileSizeExceeded, labelMaxFileSize: cfg.labelMaxFileSize, diff --git a/app/public/partage/fichiers-fragment.php b/app/public/partage/fichiers-fragment.php index 0e6dd8c..c5b4419 100644 --- a/app/public/partage/fichiers-fragment.php +++ b/app/public/partage/fichiers-fragment.php @@ -213,7 +213,7 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? ''); - +
@@ -223,17 +223,14 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? ''); class="tfe-file-picker" data-queue-type="tfe" - data-peertube-active="" data-existing-files=''> + PDF (max 100 MB) · Images (max 500 MB) · Vidéo & Audio (max 2 GB) · VTT · Archives (max 500 MB). +
Glissez pour réordonner. - PDF (max 100 MB) · Images (max 500 MB) · VTT · Archives (max 500 MB). - Vidéo & Audio → utilisez les emplacements dédiés ci-dessous. - - PDF (max 100 MB) · Images (max 500 MB) · Vidéo & Audio (max 2 GB) · VTT · Archives (max 500 MB). +
Vidéos et audio hébergés sur PeerTube. - Glissez pour réordonner. - PDFs trop lourds ? https://bentopdf.com/ +
PDFs trop lourds ? https://bentopdf.com/
@@ -254,65 +251,7 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? ''); - - -
- -
- - MP4, WebM ou MOV. Max 500 MB. Hébergé sur PeerTube. -
-
- -
- -
- - MP4, WebM ou MOV. Max 500 MB. -
-
- - - - -
- -
- - MP3, OGG, WAV, FLAC ou AAC. Max 500 MB. Hébergé sur PeerTube. -
-
- -
- -
- - MP3, OGG, WAV, FLAC ou AAC. Max 500 MB. -
-
- - - +
diff --git a/app/src/Controllers/ThesisCreateController.php b/app/src/Controllers/ThesisCreateController.php index 64dd685..2b8a8d8 100644 --- a/app/src/Controllers/ThesisCreateController.php +++ b/app/src/Controllers/ThesisCreateController.php @@ -200,31 +200,17 @@ class ThesisCreateController $this->handleFilePondSingleFile($thesisId, $post, 'cover', $folderPath, $filePrefix); $this->handleFilePondSingleFile($thesisId, $post, 'note_intention', $folderPath, $filePrefix); $nextNum = $this->handleFilePondQueueFiles($thesisId, $post, 'tfe', $folderPath, $filePrefix, 1); - $nextNum = $this->handleFilePondQueueFiles($thesisId, $post, 'video', $folderPath, $filePrefix, $nextNum); - $nextNum = $this->handleFilePondQueueFiles($thesisId, $post, 'audio', $folderPath, $filePrefix, $nextNum); $this->handleFilePondQueueFiles($thesisId, $post, 'annexe', $folderPath, $filePrefix, 0); - $this->handleFilePondQueueFiles($thesisId, $post, 'peertube_video', $folderPath, $filePrefix, 0, null); - $this->handleFilePondQueueFiles($thesisId, $post, 'peertube_audio', $folderPath, $filePrefix, 0, null); } else { // Legacy path: files arrive via multipart $_FILES $this->handleCoverUpload($thesisId, $files['couverture'] ?? null, $folderPath, $filePrefix); $this->handleNoteIntentionUpload($thesisId, $files['note_intention'] ?? null, $folderPath, $filePrefix); $queueFiles = $files['queue_file'] ?? []; $qTfe = $this->extractFilesSubArray($queueFiles, 'tfe'); - $qVideo = $this->extractFilesSubArray($queueFiles, 'video'); - $qAudio = $this->extractFilesSubArray($queueFiles, 'audio'); $qAnnexe = $this->extractFilesSubArray($queueFiles, 'annexe'); $nextNum = $this->handleTfeQueueFiles($thesisId, $qTfe, $folderPath, $filePrefix, 1); - $nextNum = $this->handleTfeQueueFiles($thesisId, $qVideo, $folderPath, $filePrefix, $nextNum); - $nextNum = $this->handleTfeQueueFiles($thesisId, $qAudio, $folderPath, $filePrefix, $nextNum); $this->handleAnnexeQueueFiles($thesisId, $qAnnexe, $folderPath, $filePrefix); - - // ── 5b. PeerTube video / audio uploads (from FilePond queue) ────────── - $qPTVideo = $this->extractFilesSubArray($queueFiles, 'peertube_video'); - $qPTAudio = $this->extractFilesSubArray($queueFiles, 'peertube_audio'); - $this->handlePeerTubeQueueFiles($thesisId, $data['titre'], $qPTVideo, 'video'); - $this->handlePeerTubeQueueFiles($thesisId, $data['titre'], $qPTAudio, 'audio'); } // ── 6. Website URL — stored as thesis_files row ────────────────────── diff --git a/app/src/Controllers/ThesisEditController.php b/app/src/Controllers/ThesisEditController.php index a85f1ff..4551285 100644 --- a/app/src/Controllers/ThesisEditController.php +++ b/app/src/Controllers/ThesisEditController.php @@ -464,35 +464,21 @@ class ThesisEditController // New path: files already on server via async FilePond uploads $nextNum = $tfeCount + 1; $nextNum = $this->handleFilePondQueueFiles($thesisId, $post, 'tfe', $folderPath, $filePrefix, $nextNum); - $nextNum = $this->handleFilePondQueueFiles($thesisId, $post, 'video', $folderPath, $filePrefix, $nextNum); - $this->handleFilePondQueueFiles($thesisId, $post, 'audio', $folderPath, $filePrefix, $nextNum); $this->handleFilePondQueueFiles($thesisId, $post, 'annexe', $folderPath, $filePrefix, 0); - $this->handleFilePondQueueFiles($thesisId, $post, 'peertube_video', $folderPath, $filePrefix, 0, $progressToken); - $this->handleFilePondQueueFiles($thesisId, $post, 'peertube_audio', $folderPath, $filePrefix, 0, $progressToken); } else { // Legacy path: files arrive via multipart $_FILES $queueFiles = $files['queue_file'] ?? []; $qTfe = $this->extractFilesSubArray($queueFiles, 'tfe'); - $qVideo = $this->extractFilesSubArray($queueFiles, 'video'); - $qAudio = $this->extractFilesSubArray($queueFiles, 'audio'); $qAnnexe = $this->extractFilesSubArray($queueFiles, 'annexe'); $startNum = $tfeCount + 1; $startNum = $this->handleTfeQueueFiles($thesisId, $qTfe, $folderPath, $filePrefix, $startNum); - $startNum = $this->handleTfeQueueFiles($thesisId, $qVideo, $folderPath, $filePrefix, $startNum); - $this->handleTfeQueueFiles($thesisId, $qAudio, $folderPath, $filePrefix, $startNum); $this->handleAnnexeQueueFiles($thesisId, $qAnnexe, $folderPath, $filePrefix); // Legacy annexe files (direct upload, non-queue path — kept for backwards compat) if (isset($files['annexes']) && is_array($files['annexes']['name'] ?? null)) { $this->handleAnnexeFiles($thesisId, $files['annexes'], $folderPath, $filePrefix, $post); } - - // ── PeerTube video / audio uploads (from FilePond queue) ────────────── - $qPTVideo = $this->extractFilesSubArray($queueFiles, 'peertube_video'); - $qPTAudio = $this->extractFilesSubArray($queueFiles, 'peertube_audio'); - $this->handlePeerTubeQueueFiles($thesisId, trim($post['titre'] ?? ''), $qPTVideo, 'video', $progressToken); - $this->handlePeerTubeQueueFiles($thesisId, trim($post['titre'] ?? ''), $qPTAudio, 'audio', $progressToken); } // ── Website URL — add or update ────────────────────────────────────── diff --git a/app/src/Controllers/ThesisFileHandler.php b/app/src/Controllers/ThesisFileHandler.php index 07f2b93..4f2bd95 100644 --- a/app/src/Controllers/ThesisFileHandler.php +++ b/app/src/Controllers/ThesisFileHandler.php @@ -1001,16 +1001,18 @@ trait ThesisFileHandler } // PeerTube files have been uploaded already; just insert DB row + // Format: peertube:video:UUID or peertube:audio:UUID if (str_starts_with($fileId, 'peertube:')) { - $uuid = substr($fileId, strlen('peertube:')); - $fileType = ($queueKey === 'peertube_video') ? 'video' : 'audio'; + $parts = explode(':', $fileId, 3); + $fileType = ($parts[1] ?? '') === 'video' ? 'video' : 'audio'; + $uuid = $parts[2] ?? ''; $storedPath = 'peertube_ids:' . $uuid; $this->db->insertThesisFile( $thesisId, $fileType, $storedPath, $uuid . ' (PeerTube)', 0, - ($queueKey === 'peertube_video') ? 'video/mp4' : 'audio/mpeg', + $fileType === 'video' ? 'video/mp4' : 'audio/mpeg', null, null ); error_log("ThesisFileHandler: PeerTube file associated → $uuid"); diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 1a15453..632ba7c 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -1559,6 +1559,19 @@ +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: uktvpzsn ce8e9ac6 "fix: track vendor JS files, add 'unsafe-inline' to public CSP, gitignore filepond tmp" (rebased revision) ++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: uktvpzsn ce8e9ac6 "fix: track vendor JS files, add 'unsafe-inline' to public CSP, gitignore filepond tmp" (rebased revision) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: tsultupz 3195eef4 "refactor: merge video/audio FilePond pools into TFE input" (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: tsultupz 0703279b "refactor: merge video/audio FilePond pools into TFE input" (rebased revision) +++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?> diff --git a/app/templates/partials/form/form.php b/app/templates/partials/form/form.php index 4530b3d..5e1bddc 100644 --- a/app/templates/partials/form/form.php +++ b/app/templates/partials/form/form.php @@ -307,7 +307,26 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? []; ?> - + (string)((int)$f['id']), + 'options' => ['type' => 'local'], + ]; + } + return $result; +}; +if ($filesMode === 'add'): ?> (string)((int)$f['id']), - 'options' => ['type' => 'local'], - ]; - } - } + $existingFilesJsonForTfe = $_buildExistingFilesJson($currentFiles ?? []); include APP_ROOT . '/public/partage/fichiers-fragment.php'; $_POST = $_savedPost; @@ -359,23 +362,8 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? []; $_POST['_cover'] = $currentCover['file_path'] ?? null; $_POST['has_annexes'] = $formData['has_annexes'] ?? null; - // Build existing-files JSON for FilePond edit mode - $existingFilesJsonForTfe = []; - if (!empty($currentFiles)) { - foreach ($currentFiles as $f) { - $ft = $f['file_type'] ?? ''; - $fp = $f['file_path'] ?? ''; - // Skip cover (handled separately) and website/peertube (no actual file) - if ($ft === 'cover' || str_starts_with($fp, 'http://') || str_starts_with($fp, 'https://') || str_starts_with($fp, 'peertube_ids:')) { - continue; - } - // Only include files that can be streamed back via load.php - $existingFilesJsonForTfe[] = [ - 'source' => (string)((int)$f['id']), - 'options' => ['type' => 'local'], - ]; - } - } + // Build existing-files JSON for FilePond edit mode (all files including PeerTube) + $existingFilesJsonForTfe = $_buildExistingFilesJson($currentFiles ?? []); include APP_ROOT . '/public/partage/fichiers-fragment.php'; $_POST = $_savedPost;