mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
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:
@@ -779,6 +779,58 @@
|
||||
+%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
+\\\\\\\ to: qrtmmwro c96116c4 "fix: make schema.sql fully idempotent — add IF NOT EXISTS to all CREATE INDEX, CREATE TRIGGER, and CREATE VIEW statements" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: qrtmmwro c96116c4 "fix: make schema.sql fully idempotent — add IF NOT EXISTS to all CREATE INDEX, CREATE TRIGGER, and CREATE VIEW statements" (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: sxpsrqsl 9b084ccb "feat: add PeerTube alternate audio/video labels and FilePond pools" (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: sxpsrqsl 32184a7a "feat: add PeerTube alternate audio/video labels and FilePond pools" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: sxpsrqsl 32184a7a "feat: add PeerTube alternate audio/video labels and FilePond pools" (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: qmoswsvt 5f00501e "feat: shared SMTP credentials + resumable PeerTube upload + embed improvements" (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: qmoswsvt 5cc189d2 "feat: shared SMTP credentials + resumable PeerTube upload + embed improvements" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: qmoswsvt 5cc189d2 "feat: shared SMTP credentials + resumable PeerTube upload + embed improvements" (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: mqoyqups 641a4db3 "feat: PeerTube channel by name, test button, always-visible FilePond pools" (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: mqoyqups 03f89c7d "feat: PeerTube channel by name, test button, always-visible FilePond pools" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: mqoyqups 03f89c7d "feat: PeerTube channel by name, test button, always-visible FilePond pools" (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: rxwmppwn 3060cae8 "fix: remove alt labels, fix curl_close deprecation, fix PeerTube description param" (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: rxwmppwn 5ae93b41 "fix: remove alt labels, fix curl_close deprecation, fix PeerTube description param" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
?>
|
||||
<tr class="admin-table-row" onclick="event.stopPropagation(); window.open('/partage/<?= urlencode($link['slug']) ?>', '_blank')" style="cursor:pointer">
|
||||
|
||||
@@ -222,6 +222,11 @@
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<p class="param-note">
|
||||
ℹ L'authentification PeerTube utilise les mêmes identifiants que le
|
||||
<strong>relay SMTP</strong> configuré ci-dessus.
|
||||
</p>
|
||||
|
||||
<div class="param-grid">
|
||||
<div>
|
||||
<label for="peertube_instance_url">URL de l'instance PeerTube</label>
|
||||
@@ -232,26 +237,11 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="peertube_username">Nom d'utilisateur</label>
|
||||
<input type="text" id="peertube_username" name="peertube_username"
|
||||
value="<?= htmlspecialchars($peerTubeSettings['username']) ?>"
|
||||
autocomplete="username">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="peertube_password">Mot de passe</label>
|
||||
<input type="password" id="peertube_password" name="peertube_password"
|
||||
value=""
|
||||
autocomplete="new-password"
|
||||
placeholder="Laissez vide pour ne pas modifier">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="peertube_channel_id">ID de la chaîne</label>
|
||||
<input type="number" id="peertube_channel_id" name="peertube_channel_id"
|
||||
value="<?= (int)$peerTubeSettings['channel_id'] ?>"
|
||||
min="1">
|
||||
<small>Identifiant numérique de la chaîne PeerTube cible.</small>
|
||||
<label for="peertube_channel_name">Nom de la chaîne</label>
|
||||
<input type="text" id="peertube_channel_name" name="peertube_channel_name"
|
||||
value="<?= htmlspecialchars($peerTubeSettings['channel_name'] ?? '') ?>"
|
||||
placeholder="xamxam_erg.be_channel@videos.erg.be">
|
||||
<small>Identifiant complet de la chaîne (handle), ex : <code>nom_de_chaîne@hôte</code>.</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -265,6 +255,15 @@
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
||||
<button type="button" class="btn btn--secondary" id="peertube-test-btn"
|
||||
hx-post="/admin/actions/peertube-test.php"
|
||||
hx-target="#peertube-test-result"
|
||||
hx-include="closest form"
|
||||
hx-indicator="#peertube-test-spinner">
|
||||
Tester la connexion
|
||||
</button>
|
||||
<span id="peertube-test-spinner" class="htmx-indicator" style="display:none;margin-left:var(--space-xs);">⏳</span>
|
||||
<div id="peertube-test-result" style="margin-top:var(--space-xs);"></div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -95,8 +95,23 @@
|
||||
<?php
|
||||
$mime = $f['mime_type'] ?? '';
|
||||
$isImage = str_starts_with($mime, 'image/');
|
||||
$mediaUrl = '/media?path=' . urlencode($f['file_path']);
|
||||
$fileName = htmlspecialchars($f['file_name'] ?? basename($f['file_path']));
|
||||
$filePath = $f['file_path'] ?? '';
|
||||
$isPeerTube = str_starts_with($filePath, 'peertube_ids:');
|
||||
if ($isPeerTube) {
|
||||
$_ptUuid = substr($filePath, strlen('peertube_ids:'));
|
||||
require_once APP_ROOT . '/src/PeerTubeService.php';
|
||||
$_ptDb = new Database();
|
||||
$_ptS = PeerTubeService::getSettings($_ptDb);
|
||||
// Only link to watch page for public (1) and unlisted (2) videos
|
||||
if ((int)$_ptS['privacy'] <= 2) {
|
||||
$mediaUrl = PeerTubeService::getWatchUrl($_ptDb, $_ptUuid);
|
||||
} else {
|
||||
$mediaUrl = '#';
|
||||
}
|
||||
} else {
|
||||
$mediaUrl = '/media?path=' . urlencode($filePath);
|
||||
}
|
||||
$fileName = htmlspecialchars($f['file_name'] ?? basename($filePath));
|
||||
$fileType = htmlspecialchars($f['file_type']);
|
||||
?>
|
||||
<li class="recap-file-item">
|
||||
@@ -107,7 +122,9 @@
|
||||
<?php else: ?>
|
||||
<span class="recap-file-icon">
|
||||
<?php
|
||||
if ($mime === 'application/pdf') echo '📄';
|
||||
if ($isPeerTube && $f['file_type'] === 'video') echo '🎬';
|
||||
elseif ($isPeerTube && $f['file_type'] === 'audio') echo '🎵';
|
||||
elseif ($mime === 'application/pdf') echo '📄';
|
||||
elseif (str_starts_with($mime, 'video/')) echo '🎬';
|
||||
elseif (str_starts_with($mime, 'audio/')) echo '🎵';
|
||||
elseif (in_array($mime, ['application/zip','application/x-zip-compressed'])) echo '🗜️';
|
||||
|
||||
35
app/templates/partials/peertube-embed.php
Normal file
35
app/templates/partials/peertube-embed.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* peertube-embed.php
|
||||
*
|
||||
* Renders a PeerTube video/audio embed iframe from a stored peertube_ids:{uuid} value.
|
||||
*
|
||||
* Expected variables:
|
||||
* string $peertubeUuid — the PeerTube video shortUUID
|
||||
* string $title — title attribute for the iframe
|
||||
* string $instanceUrl — base URL of the PeerTube instance (e.g. https://videos.erg.be)
|
||||
* int $width — iframe width (default 560)
|
||||
* int $height — iframe height (default 315)
|
||||
*/
|
||||
|
||||
$peertubeUuid = $peertubeUuid ?? '';
|
||||
$title = $title ?? 'PeerTube video';
|
||||
$instanceUrl = $instanceUrl ?? '';
|
||||
$width = $width ?? 560;
|
||||
$height = $height ?? 315;
|
||||
|
||||
if ($peertubeUuid === '' || $instanceUrl === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$embedUrl = rtrim($instanceUrl, '/') . '/videos/embed/' . $peertubeUuid;
|
||||
?>
|
||||
<iframe
|
||||
title="<?= htmlspecialchars($title) ?>"
|
||||
width="<?= (int)$width ?>"
|
||||
height="<?= (int)$height ?>"
|
||||
src="<?= htmlspecialchars($embedUrl) ?>"
|
||||
style="border: 0px;"
|
||||
allow="fullscreen"
|
||||
sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
|
||||
></iframe>
|
||||
@@ -419,6 +419,22 @@
|
||||
})();
|
||||
</script>
|
||||
<?php elseif (!empty($data["files"])): ?>
|
||||
<?php
|
||||
// Preload PeerTube instance URL once
|
||||
$_ptHasAnyPeerTube = false;
|
||||
foreach ($data['files'] as $_f) {
|
||||
if (str_starts_with($_f['file_path'] ?? '', 'peertube_ids:')) {
|
||||
$_ptHasAnyPeerTube = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$_ptInstanceUrl = '';
|
||||
if ($_ptHasAnyPeerTube) {
|
||||
require_once APP_ROOT . '/src/PeerTubeService.php';
|
||||
$_ptSettings = PeerTubeService::getSettings(Database::getInstance());
|
||||
$_ptInstanceUrl = $_ptSettings['instance_url'] ?? '';
|
||||
}
|
||||
?>
|
||||
<?php foreach ($data["files"] as $file): ?>
|
||||
<?php
|
||||
$ext = strtolower(pathinfo($file["file_path"] ?? '', PATHINFO_EXTENSION));
|
||||
@@ -445,7 +461,8 @@
|
||||
$caption = !empty($file["display_label"]) ? $file["display_label"] : ($file["description"] ?? '');
|
||||
$filePath = $file['file_path'] ?? '';
|
||||
$isExternalUrl = str_starts_with($filePath, 'http://') || str_starts_with($filePath, 'https://');
|
||||
$mediaUrl = $isExternalUrl ? htmlspecialchars($filePath) : ('/media?path=' . urlencode($filePath));
|
||||
$isPeerTube = str_starts_with($filePath, 'peertube_ids:');
|
||||
$mediaUrl = $isPeerTube ? '' : ($isExternalUrl ? htmlspecialchars($filePath) : ('/media?path=' . urlencode($filePath)));
|
||||
$fileName = htmlspecialchars($file["file_name"] ?? basename($filePath));
|
||||
?>
|
||||
<figure>
|
||||
@@ -476,6 +493,14 @@
|
||||
<img src="<?= $mediaUrl ?>"
|
||||
alt="<?= htmlspecialchars($caption !== '' ? $caption : $data['title'] . ' — ' . ($data['authors'] ?? '')) ?>">
|
||||
<?php elseif ($isVideo): ?>
|
||||
<?php if ($isPeerTube): ?>
|
||||
<?php
|
||||
$peertubeUuid = substr($filePath, strlen('peertube_ids:'));
|
||||
$title = $fileName;
|
||||
$instanceUrl = $_ptInstanceUrl;
|
||||
include APP_ROOT . '/templates/partials/peertube-embed.php';
|
||||
?>
|
||||
<?php else: ?>
|
||||
<video width="100%" controls>
|
||||
<source src="<?= $mediaUrl ?>" type="video/<?= htmlspecialchars($ext === 'mov' ? 'mp4' : $ext) ?>">
|
||||
<?php if ($_vttPath): ?>
|
||||
@@ -484,7 +509,18 @@
|
||||
srclang="fr" label="Sous-titres" default>
|
||||
<?php endif; ?>
|
||||
</video>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($isAudio): ?>
|
||||
<?php if ($isPeerTube): ?>
|
||||
<?php
|
||||
$peertubeUuid = substr($filePath, strlen('peertube_ids:'));
|
||||
$title = $fileName;
|
||||
$instanceUrl = $_ptInstanceUrl;
|
||||
$width = 560;
|
||||
$height = 80;
|
||||
include APP_ROOT . '/templates/partials/peertube-embed.php';
|
||||
?>
|
||||
<?php else: ?>
|
||||
<audio controls class="tfe-audio">
|
||||
<source src="<?= $mediaUrl ?>" type="audio/<?= htmlspecialchars(match($ext) {
|
||||
'mp3' => 'mpeg',
|
||||
@@ -497,6 +533,7 @@
|
||||
}) ?>">
|
||||
Votre navigateur ne supporte pas la lecture audio.
|
||||
</audio>
|
||||
<?php endif; ?>
|
||||
<?php else: /* other — download only */ ?>
|
||||
<div class="tfe-download-file">
|
||||
<a href="<?= $mediaUrl ?>&download=1" class="tfe-download-link">
|
||||
|
||||
Reference in New Issue
Block a user