feat: permit to play Funkwhale songs

This commit is contained in:
2025-10-17 21:23:44 +04:00
parent 95de788114
commit b3ee9d9837
4 changed files with 233 additions and 13 deletions
+31 -9
View File
@@ -208,15 +208,15 @@ setSecurityHeaders();
if (empty($funkwhaleTracks)) {
echo '<div class="funkwhale-no-tracks">Aucun morceau disponible</div>';
} else {
foreach ($funkwhaleTracks as $track):
foreach ($funkwhaleTracks as $index => $track):
?>
<a href="<?php echo htmlspecialchars($track['link']); ?>"
class="funkwhale-track-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($track['title'] . ' - ' . $track['artist']); ?>">
<div class="funkwhale-track-item"
data-track-id="<?php echo $index; ?>"
data-audio-url="<?php echo htmlspecialchars($track['audioUrl']); ?>">
<div class="funkwhale-track-thumb">
<button class="funkwhale-track-thumb funkwhale-play-btn"
type="button"
aria-label="Lire <?php echo htmlspecialchars($track['title']); ?>">
<?php if (!empty($track['cover'])): ?>
<img src="<?php echo htmlspecialchars($track['cover']); ?>"
alt="<?php echo htmlspecialchars($track['album']); ?>"
@@ -224,10 +224,13 @@ setSecurityHeaders();
<div class="funkwhale-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<div class="funkwhale-pause-icon">
<i class="fas fa-pause-circle"></i>
</div>
<?php else: ?>
<i class="fas fa-music"></i>
<?php endif; ?>
</div>
</button>
<div class="funkwhale-track-info">
<h3 class="funkwhale-track-title">
@@ -246,7 +249,21 @@ setSecurityHeaders();
<?php endif; ?>
</div>
</div>
</a>
<a href="<?php echo htmlspecialchars($track['link']); ?>"
class="funkwhale-external-link"
target="_blank"
rel="noopener noreferrer"
title="Voir sur Funkwhale"
aria-label="Voir <?php echo htmlspecialchars($track['title']); ?> sur Funkwhale">
<i class="fas fa-external-link-alt"></i>
</a>
<!-- Élément audio caché -->
<audio preload="none">
<source src="<?php echo htmlspecialchars($track['audioUrl']); ?>" type="audio/mpeg">
</audio>
</div>
<?php
endforeach;
}
@@ -704,5 +721,10 @@ setSecurityHeaders();
}
});
</script>
<?php if (defined('FUNKWHALE_ENABLED') && FUNKWHALE_ENABLED): ?>
<!-- Lecteur audio Funkwhale -->
<script src="js/funkwhale-player.js?v=<?php echo filemtime('js/funkwhale-player.js'); ?>"></script>
<?php endif; ?>
</body>
</html>