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:
@@ -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