mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
refactor: merge video/audio FilePond pools into TFE input
- Remove separate video/audio/peertube_video/peertube_audio pools from UI - TFE pool now accepts all file types including video/audio - When PeerTube is enabled, video/audio dropped into TFE pool auto-upload to PeerTube (process.php detects MIME and uploads immediately) - PeerTube return IDs now encode type: peertube:video:UUID or peertube:audio:UUID - load.php returns placeholder SVG for PeerTube files so they appear in FilePond - Edit mode: all existing files (including PeerTube) shown in TFE FilePond pool - Remove legacy video/audio/peertube_* handling from both controllers - Remove unused vide/audio/peertube_* entries from JS QUEUE_CONFIG
This commit is contained in:
@@ -307,7 +307,26 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
||||
?>
|
||||
|
||||
<!-- ═══════════════════ Format(s) + Fichiers ═══════════════════ -->
|
||||
<?php if ($filesMode === 'add'): ?>
|
||||
<?php
|
||||
// Helper: build existing-files JSON for FilePond TFE pool (including PeerTube)
|
||||
$_buildExistingFilesJson = function (array $files): array {
|
||||
$result = [];
|
||||
foreach ($files as $f) {
|
||||
$ft = $f['file_type'] ?? '';
|
||||
$fp = $f['file_path'] ?? '';
|
||||
// Skip cover (handled separately) and website URLs (no actual file)
|
||||
if ($ft === 'cover' || str_starts_with($fp, 'http://') || str_starts_with($fp, 'https://')) {
|
||||
continue;
|
||||
}
|
||||
// Include PeerTube files too — load.php now handles them
|
||||
$result[] = [
|
||||
'source' => (string)((int)$f['id']),
|
||||
'options' => ['type' => 'local'],
|
||||
];
|
||||
}
|
||||
return $result;
|
||||
};
|
||||
if ($filesMode === 'add'): ?>
|
||||
<?php
|
||||
// Add / partage mode: Format + Fichiers rendered as one HTMX-swappable block.
|
||||
// Synthesise POST-like data so fichiers-fragment.php can render the initial state.
|
||||
@@ -324,23 +343,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
||||
$_POST['admin_mode'] = $adminMode ? '1' : '0';
|
||||
$_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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
$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;
|
||||
|
||||
Reference in New Issue
Block a user