feat: add À la une feature

This commit is contained in:
2026-01-14 16:51:44 +04:00
parent 66de41b118
commit 10f0b9a6eb
6 changed files with 149 additions and 34 deletions
+34 -19
View File
@@ -14,8 +14,9 @@ require_once 'includes/structured-data.php';
// Appliquer les en-têtes de sécurité
setSecurityHeaders();
// Vérifier s'il y a un direct en cours
$liveStream = getLiveStream();
// Récupérer la vidéo à afficher selon le mode configuré
$displayData = getDisplayVideo();
$video = $displayData['video'];
?>
<!DOCTYPE html>
<html lang="fr">
@@ -113,40 +114,54 @@ $liveStream = getLiveStream();
</div>
<div class="live-container">
<?php
// Vérifier s'il y a un direct en cours
$liveStream = getLiveStream();
if ($liveStream) {
// Afficher le direct en cours
<?php
// Récupérer les données d'affichage
$isLive = $displayData['isLive'];
$badge = $displayData['badge'];
$mode = $displayData['mode'];
if ($video) {
// Construire les paramètres de l'iframe selon le mode
$iframeParams = '';
if ($mode === 'auto' && $isLive) {
// Mode auto avec direct : autoplay
$iframeParams = '?autoplay=1';
}
// Mode static : pas d'autoplay
// Afficher la vidéo
?>
<div class="live-badge large">
<i class="fas fa-circle"></i> EN DIRECT
<?php if ($isLive): ?>
<i class="fas fa-circle"></i> <?php echo htmlspecialchars($badge); ?>
<?php else: ?>
<?php echo htmlspecialchars($badge); ?>
<?php endif; ?>
</div>
<div class="live-player">
<iframe
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $liveStream['id']; ?>?autoplay=1"
frameborder="0"
<iframe
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $video['id']; ?><?php echo $iframeParams; ?>"
frameborder="0"
allowfullscreen="allowfullscreen"
allow="autoplay; fullscreen"
title="<?php echo htmlspecialchars($liveStream['title']); ?>">
title="<?php echo htmlspecialchars($video['title']); ?>">
</iframe>
</div>
<div class="live-info">
<h1 class="live-title"><?php echo htmlspecialchars($liveStream['title']); ?></h1>
<h1 class="live-title"><?php echo htmlspecialchars($video['title']); ?></h1>
<div class="live-channel-info">
<?php if (strpos($liveStream['channelAvatar'], 'default-avatar.png') !== false || empty($liveStream['channelAvatar'])): ?>
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
<div class="channel-avatar-placeholder">
<i class="fas fa-user-circle"></i>
</div>
<?php else: ?>
<img src="<?php echo $liveStream['channelAvatar']; ?>" alt="<?php echo $liveStream['channel']; ?>" class="channel-avatar">
<img src="<?php echo $video['channelAvatar']; ?>" alt="<?php echo $video['channel']; ?>" class="channel-avatar">
<?php endif; ?>
<span class="channel-name"><?php echo $liveStream['channel']; ?></span>
<span class="channel-name"><?php echo $video['channel']; ?></span>
</div>
<?php if (!empty($liveStream['description'])): ?>
<?php if (!empty($video['description'])): ?>
<div class="live-description">
<?php echo markdown_to_html($liveStream['description']); ?>
<?php echo markdown_to_html($video['description']); ?>
</div>
<?php endif; ?>
</div>