feat: PeerTube integration — alternate audio/video labels, FilePond pools, shared SMTP credentials, channel by name, test button, resumable upload, embed improvements, fix alt labels/curl_close/deprecation

This commit is contained in:
Pontoporeia
2026-05-11 10:47:33 +02:00
parent 28ef35dce5
commit 83a5a508ea
18 changed files with 748 additions and 261 deletions

View File

@@ -24,6 +24,7 @@
require_once APP_ROOT . '/src/PeerTubeService.php';
$_ptDb = Database::getInstance();
$peerTubeEnabled = PeerTubeService::isEnabled($_ptDb);
$peerTubeSettings = PeerTubeService::getSettings($_ptDb);
$db = $_ptDb->getConnection();
@@ -98,6 +99,20 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
hx-trigger="change"
hx-include="[name='formats[]'], [name='website_url'], [name='admin_mode'], [name='edit_mode'], [name='_cover']"
hx-swap="outerHTML"
<?php elseif ((int)$opt['id'] === ($videoId ?? 0)): ?>
hx-post="<?= htmlspecialchars($hxPost) ?>"
hx-target="#slot-video"
hx-select="#slot-video"
hx-trigger="change"
hx-include="[name='formats[]'], [name='admin_mode'], [name='edit_mode'], [name='_cover']"
hx-swap="outerHTML"
<?php elseif ((int)$opt['id'] === ($audioId ?? 0)): ?>
hx-post="<?= htmlspecialchars($hxPost) ?>"
hx-target="#slot-audio"
hx-select="#slot-audio"
hx-trigger="change"
hx-include="[name='formats[]'], [name='admin_mode'], [name='edit_mode'], [name='_cover']"
hx-swap="outerHTML"
<?php endif; ?>
>
<?= htmlspecialchars($opt['name']) ?>
@@ -142,9 +157,13 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
// ── Existing files ──
$_thesisFilesList = array_values(array_filter($_efiles, fn($f) => $f["file_type"] !== "cover"));
foreach ($_thesisFilesList as $_f):
$_fExt = strtolower(pathinfo($_f["file_path"] ?? "", PATHINFO_EXTENSION));
$_fPath = $_f["file_path"] ?? "";
$_fIsPeerTube = str_starts_with($_fPath, "peertube_ids:");
$_fExt = strtolower(pathinfo($_fPath, PATHINFO_EXTENSION));
$_fType = $_f["file_type"] ?? "other";
$_fIcon = match (true) {
$_fIsPeerTube && $_fType === "video" => "🎬",
$_fIsPeerTube && $_fType === "audio" => "🔊",
$_fType === "main" || $_fExt === "pdf" => "📄",
in_array($_fExt, ["jpg","jpeg","png","gif","webp"]) => "🖼️",
$_fType === "video" || in_array($_fExt, ["mp4","webm","mov","ogv"]) => "🎬",
@@ -153,8 +172,8 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
$_fType === "website" => "🌐",
default => "📎",
};
$_fIsExternal = str_starts_with($_f["file_path"] ?? "", "http://") || str_starts_with($_f["file_path"] ?? "", "https://");
$_fLinkHref = $_fIsExternal ? htmlspecialchars($_f["file_path"]) : "/media?path=" . urlencode($_f["file_path"]);
$_fIsExternal = str_starts_with($_fPath, "http://") || str_starts_with($_fPath, "https://");
$_fLinkHref = $_fIsPeerTube ? "#" : ($_fIsExternal ? htmlspecialchars($_fPath) : "/media?path=" . urlencode($_fPath));
?>
<li class="admin-file-list-item" data-file-id="<?= (int)$_f["id"] ?>">
<input type="hidden" name="file_sort_order[]" value="<?= (int)$_f["id"] ?>">
@@ -222,9 +241,15 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
name="queue_file[tfe][]"
multiple
class="tfe-file-picker"
<?= !$adminMode ? 'required' : '' ?>>
<?= !$adminMode ? 'required' : '' ?>
data-peertube-active="<?= $peerTubeEnabled ? '1' : '0' ?>">
<small class="admin-file-hint">
<?php if ($peerTubeEnabled): ?>
PDF (max 100 MB) · Images (max 500 MB) · VTT · Archives (max 500 MB).
Vidéo & Audio → utilisez les emplacements dédiés ci-dessous.
<?php else: ?>
PDF (max 100 MB) · Images (max 500 MB) · Vidéo & Audio (max 2 GB) · VTT · Archives (max 500 MB).
<?php endif; ?>
Glissez pour réordonner.
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">https://bentopdf.com/</a>
</small>
@@ -265,20 +290,21 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
<div id="slot-siteweb" hidden></div>
<?php endif; ?>
<!-- Slot: Video (disabled — video files are now uploaded via the TFE input) -->
<!--
<?php if ($hasVideo): ?>
<!-- Slot: Video (always visible when PeerTube enabled) -->
<?php if ($peerTubeEnabled): ?>
<div id="slot-video" class="admin-form-group">
<label for="peertube_video">Vidéo PeerTube<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div id="slot-video" class="admin-form-group admin-files-fieldgroup">
<label for="peertube-video-input">Vidéo<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div class="admin-file-input">
<input type="file" id="peertube_video" name="peertube_video"
<input type="file" id="peertube-video-input"
name="queue_file[peertube_video][]"
multiple
accept="video/mp4,video/webm,video/ogg,video/quicktime,.mp4,.webm,.ogv,.mov"
class="tfe-file-picker"
<?= !$adminMode ? 'required' : '' ?>>
<small>MP4, WebM ou MOV. La vidéo sera hébergée sur PeerTube. Max 500 MB.</small>
<small class="admin-file-hint">MP4, WebM ou MOV. Max 500 MB. Glissez pour réordonner. Hébergé sur <a href="<?= htmlspecialchars($peerTubeSettings['instance_url']) ?>" target="_blank" rel="noopener">PeerTube</a>.</small>
</div>
</div>
<?php else: ?>
<?php elseif ($hasVideo): ?>
<div id="slot-video" class="admin-form-group admin-files-fieldgroup">
<label for="video-files-input">Vidéo<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div class="admin-file-input">
@@ -291,27 +317,25 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
<small class="admin-file-hint">MP4, WebM ou MOV. Max 500 MB. Glissez pour réordonner.</small>
</div>
</div>
<?php endif; ?>
<?php else: ?>
<div id="slot-video" hidden></div>
<?php endif; ?>
-->
<div id="slot-video" hidden></div>
<!-- Slot: Audio (disabled — audio files are now uploaded via the TFE input) -->
<!--
<?php if ($hasAudio): ?>
<!-- Slot: Audio (always visible when PeerTube enabled) -->
<?php if ($peerTubeEnabled): ?>
<div id="slot-audio" class="admin-form-group">
<label for="peertube_audio">Audio PeerTube<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div id="slot-audio" class="admin-form-group admin-files-fieldgroup">
<label for="peertube-audio-input">Audio<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div class="admin-file-input">
<input type="file" id="peertube_audio" name="peertube_audio"
<input type="file" id="peertube-audio-input"
name="queue_file[peertube_audio][]"
multiple
accept="audio/mpeg,audio/ogg,audio/wav,audio/flac,audio/aac,audio/mp4,.mp3,.ogg,.oga,.wav,.flac,.aac,.m4a"
class="tfe-file-picker"
<?= !$adminMode ? 'required' : '' ?>>
<small>MP3, OGG, WAV, FLAC ou AAC. Le fichier sera hébergé sur PeerTube. Max 500 MB.</small>
<small class="admin-file-hint">MP3, OGG, WAV, FLAC ou AAC. Max 500 MB. Glissez pour réordonner. Hébergé sur <a href="<?= htmlspecialchars($peerTubeSettings['instance_url']) ?>" target="_blank" rel="noopener">PeerTube</a>.</small>
</div>
</div>
<?php else: ?>
<?php elseif ($hasAudio): ?>
<div id="slot-audio" class="admin-form-group admin-files-fieldgroup">
<label for="audio-files-input">Audio<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?></label>
<div class="admin-file-input">
@@ -324,12 +348,9 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']);
<small class="admin-file-hint">MP3, OGG, WAV, FLAC ou AAC. Max 500 MB. Glissez pour réordonner.</small>
</div>
</div>
<?php endif; ?>
<?php else: ?>
<div id="slot-audio" hidden></div>
<?php endif; ?>
-->
<div id="slot-audio" hidden></div>
</div>