feat: permit display one video in index

This commit is contained in:
2025-10-17 14:23:31 +04:00
parent 8905d09b48
commit b35dbde8c9
4 changed files with 76 additions and 10 deletions
+5 -1
View File
@@ -108,12 +108,16 @@ if (!defined('CACHE_DURATION')) define('CACHE_DURATION', 3600); // En secondes (
// =========================================
// Type de contenu à afficher dans la section hero
// Options: 'live' (direct PeerTube), 'playlist' (playlist audio/vidéo), 'none' (masquer)
// Options: 'live' (direct PeerTube), 'playlist' (playlist audio/vidéo), 'video' (vidéo unique), 'none' (masquer)
if (!defined('HERO_TYPE')) define('HERO_TYPE', 'live');
// Configuration pour le direct (HERO_TYPE = 'live')
if (!defined('LIVE_ACCOUNT_NAME')) define('LIVE_ACCOUNT_NAME', 'admin');
// Configuration pour une vidéo unique (HERO_TYPE = 'video')
if (!defined('HERO_VIDEO_ID')) define('HERO_VIDEO_ID', '1aJ2u9euwF9fWKQhFxwFio');
if (!defined('HERO_VIDEO_TITLE')) define('HERO_VIDEO_TITLE', 'Vidéo de présentation');
// Configuration pour les playlists (HERO_TYPE = 'playlist')
// Type de plateforme: 'peertube', 'funkwhale', 'castopod'
if (!defined('PLAYLIST_PLATFORM')) define('PLAYLIST_PLATFORM', 'peertube');
+8 -1
View File
@@ -34,12 +34,19 @@ define('APP_HOST_NAME', 'fediverse.o-k-i.net');
// =========================================
// Type de contenu à afficher dans la section hero
// Options: 'live' (direct PeerTube), 'playlist' (playlist audio/vidéo), 'none' (masquer)
// Options: 'live' (direct PeerTube), 'video' (vidéo unique), 'playlist' (playlist audio/vidéo), 'none' (masquer)
// define('HERO_TYPE', 'live');
// Configuration pour le direct (HERO_TYPE = 'live')
// define('LIVE_ACCOUNT_NAME', 'admin');
// Configuration pour une vidéo unique (HERO_TYPE = 'video')
// ID de la vidéo (extrait de l'URL: https://gade.o-k-i.net/w/VIDEO_ID)
// define('HERO_VIDEO_ID', '1aJ2u9euwF9fWKQhFxwFio');
// Titre de la vidéo (optionnel, pour l'accessibilité)
// define('HERO_VIDEO_TITLE', 'Vidéo de présentation');
// Configuration pour les playlists (HERO_TYPE = 'playlist')
// Type de plateforme: 'peertube', 'funkwhale', 'castopod'
// define('PLAYLIST_PLATFORM', 'peertube');
+37 -2
View File
@@ -1,9 +1,10 @@
<?php
/**
* Section Hero - Affichage conditionnel (Direct / Playlist / Rien)
* Section Hero - Affichage conditionnel (Direct / Playlist / Vidéo / Rien)
*
* Ce fichier gère l'affichage de la section hero en fonction de la configuration:
* - HERO_TYPE = 'live': Affiche le direct PeerTube
* - HERO_TYPE = 'video': Affiche une vidéo PeerTube unique
* - HERO_TYPE = 'playlist': Affiche une playlist (PeerTube/Funkwhale/Castopod)
* - HERO_TYPE = 'none': N'affiche rien
*/
@@ -19,7 +20,15 @@ if ($heroType === 'none') {
<section class="hero" aria-labelledby="hero-section-title">
<h2 id="hero-section-title" class="sr-only">
<?php echo $heroType === 'live' ? 'Diffusion en direct' : 'Playlist'; ?>
<?php
if ($heroType === 'live') {
echo 'Diffusion en direct';
} elseif ($heroType === 'video') {
echo 'Vidéo';
} else {
echo 'Playlist';
}
?>
</h2>
<?php if ($heroType === 'live'): ?>
@@ -252,5 +261,31 @@ if ($heroType === 'none') {
</div>
<?php endif; ?>
<?php elseif ($heroType === 'video'): ?>
<!-- Mode VIDÉO -->
<?php
$videoId = defined('HERO_VIDEO_ID') ? HERO_VIDEO_ID : '';
$videoTitle = defined('HERO_VIDEO_TITLE') ? HERO_VIDEO_TITLE : 'Vidéo de présentation';
if (!empty($videoId)):
?>
<div class="hero-video-container">
<iframe
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $videoId; ?>"
frameborder="0"
allowfullscreen="allowfullscreen"
sandbox="allow-same-origin allow-scripts allow-popups"
allow="autoplay; fullscreen"
title="<?php echo htmlspecialchars($videoTitle); ?>">
</iframe>
</div>
<?php else: ?>
<div class="hero-no-live">
<i class="fas fa-video"></i>
<h2>Vidéo non configurée</h2>
<p>Configurez HERO_VIDEO_ID dans votre fichier de configuration.</p>
</div>
<?php endif; ?>
<?php endif; ?>
</section>