feat: add Funkwhale integration

This commit is contained in:
2025-10-17 21:10:20 +04:00
parent 0319fa20c3
commit 95de788114
6 changed files with 637 additions and 11 deletions
+151 -11
View File
@@ -30,6 +30,10 @@ setSecurityHeaders();
<?php if (defined('CASTOPOD_ENABLED') && CASTOPOD_ENABLED): ?>
<link rel="stylesheet" href="css/castopod-podcasts.css?v=<?php echo filemtime('css/castopod-podcasts.css'); ?>">
<?php endif; ?>
<?php if (defined('FUNKWHALE_ENABLED') && FUNKWHALE_ENABLED): ?>
<link rel="stylesheet" href="css/funkwhale-tracks.css?v=<?php echo filemtime('css/funkwhale-tracks.css'); ?>">
<?php endif; ?>
<link rel="stylesheet" href="css/grid-layout.css?v=<?php echo filemtime('css/grid-layout.css'); ?>">
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
@@ -104,10 +108,11 @@ setSecurityHeaders();
<?php include 'includes/header.php'; ?>
<!-- Hero and Mastodon container -->
<div class="hero-mastodon-wrapper">
<!-- Hero Banner -->
<?php include 'includes/hero-section.php'; ?>
<div class="timeline-wordpress-container">
<!-- Hero Banner -->
<?php include 'includes/hero-section.php'; ?>
<!-- Section Podcasts Castopod -->
<!-- Section Podcasts Castopod -->
<?php if (defined('CASTOPOD_ENABLED') && CASTOPOD_ENABLED && defined('CASTOPOD_URL') && !empty(CASTOPOD_URL)): ?>
<div class="castopod-section">
<div class="castopod-container">
@@ -180,16 +185,151 @@ setSecurityHeaders();
</div>
<?php endif; ?>
<!-- Container pour Mastodon et Castopod côte à côte -->
<div style="<?php if(defined('HERO_TYPE') && HERO_TYPE !== 'none'): echo 'grid-column: 1 / -1;'; endif; ?>" class="timeline-container">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
<!-- Section Morceaux Funkwhale -->
<?php if (defined('FUNKWHALE_ENABLED') && FUNKWHALE_ENABLED && defined('FUNKWHALE_URL') && !empty(FUNKWHALE_URL)): ?>
<div class="funkwhale-section">
<div class="funkwhale-container">
<div class="funkwhale-header">
<i class="fas fa-music"></i>
Morceaux
<?php if (!empty(FUNKWHALE_URL)): ?>
<a href="<?php echo htmlspecialchars(FUNKWHALE_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(FUNKWHALE_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(FUNKWHALE_URL, PHP_URL_HOST)); ?>
</a>
<?php endif; ?>
</div>
<div class="funkwhale-tracks-list">
<?php
$funkwhaleTracks = getFunkwhaleTracks();
if (empty($funkwhaleTracks)) {
echo '<div class="funkwhale-no-tracks">Aucun morceau disponible</div>';
} else {
foreach ($funkwhaleTracks as $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-thumb">
<?php if (!empty($track['cover'])): ?>
<img src="<?php echo htmlspecialchars($track['cover']); ?>"
alt="<?php echo htmlspecialchars($track['album']); ?>"
loading="lazy">
<div class="funkwhale-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<?php else: ?>
<i class="fas fa-music"></i>
<?php endif; ?>
</div>
<div class="funkwhale-track-info">
<h3 class="funkwhale-track-title">
<?php echo htmlspecialchars($track['title']); ?>
</h3>
<div class="funkwhale-track-artist">
<i class="fas fa-user"></i> <?php echo htmlspecialchars($track['artist']); ?>
</div>
<div class="funkwhale-track-meta">
<span><i class="fas fa-compact-disc"></i> <?php echo htmlspecialchars($track['album']); ?></span>
<?php if (!empty($track['formattedDuration'])): ?>
<span>•</span>
<span><i class="far fa-clock"></i> <?php echo htmlspecialchars($track['formattedDuration']); ?></span>
<?php endif; ?>
</div>
</div>
</a>
<?php
endforeach;
}
?>
</div>
</div>
</div>
<?php endif; ?>
<!-- Timeline Mastodon -->
<div class="mastodon-section">
<div id="mt-container" class="mt-container">
<div class="mt-header">
<h2 class="mt-title">Fil d'actualités <i class="fab fa-mastodon"></i></h2>
</div>
<div class="mt-body" role="feed">
<div class="mt-loading-spinner"></div>
</div>
</div>
</div>
<!-- Section Articles WordPress -->
<?php if (defined('WORDPRESS_ENABLED') && WORDPRESS_ENABLED && !empty(WORDPRESS_URL)): ?>
<div class="wordpress-section">
<div class="wordpress-container">
<div class="wordpress-header">
<i class="fas fa-newspaper"></i>
Articles <?php if (!empty(WORDPRESS_URL)): ?>
<a href="<?php echo htmlspecialchars(WORDPRESS_URL); ?>"
target="_blank"
rel="noopener noreferrer"
title="Visiter <?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>">
<?php echo htmlspecialchars(parse_url(WORDPRESS_URL, PHP_URL_HOST)); ?>
</a>
<?php endif; ?>
</div>
<div class="wordpress-posts-list">
<?php
$wordpressPosts = getWordPressPosts();
if (empty($wordpressPosts)) {
echo '<div class="wordpress-no-posts">Aucun article disponible</div>';
} else {
foreach ($wordpressPosts as $post):
?>
<a href="<?php echo htmlspecialchars($post['link']); ?>"
class="wordpress-post-item"
target="_blank"
rel="noopener noreferrer"
title="<?php echo htmlspecialchars($post['title']); ?>">
<div class="wordpress-post-thumb">
<?php if (!empty($post['featured_image'])): ?>
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>"
alt="<?php echo htmlspecialchars($post['title']); ?>"
loading="lazy">
<?php else: ?>
<i class="fas fa-file-alt"></i>
<?php endif; ?>
</div>
<div class="wordpress-post-info">
<h3 class="wordpress-post-title">
<?php echo htmlspecialchars($post['title']); ?>
</h3>
<div class="wordpress-post-meta">
<span><?php echo htmlspecialchars($post['date']); ?></span>
<?php if (!empty($post['author'])): ?>
<span>•</span>
<span><?php echo htmlspecialchars($post['author']); ?></span>
<?php endif; ?>
</div>
</div>
</a>
<?php
endforeach;
}
?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>