diff --git a/public/feed.php b/public/feed.php index ae13e00..1c63f97 100644 --- a/public/feed.php +++ b/public/feed.php @@ -4,12 +4,8 @@ declare(strict_types=1); define('BASE_PATH', realpath(__DIR__ . '/../')); -if (session_status() === PHP_SESSION_NONE) { - $isHttps = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; - session_set_cookie_params(['lifetime' => 0, 'path' => '/', 'secure' => $isHttps, 'httponly' => true, 'samesite' => 'Lax']); - session_start(); -} - +require_once BASE_PATH . '/bootstrap.php'; +require_once BASE_PATH . '/src/helpers.php'; require_once BASE_PATH . '/src/auth.php'; require_once BASE_PATH . '/config/config.php'; require_once BASE_PATH . '/src/ArticleManager.php'; @@ -26,12 +22,85 @@ $all = array_values(array_filter( static fn (array $a): bool => strtotime((string)($a['published_at'] ?? '')) <= $now )); +// ─── Détection navigateur ──────────────────────────────────────────────────── +$accept = $_SERVER['HTTP_ACCEPT'] ?? ''; +$isBrowser = str_contains($accept, 'text/html') + && !str_contains($accept, 'application/rss+xml'); + +if ($isBrowser) { + require_once BASE_PATH . '/src/Parsedown.php'; + $Parsedown = new Parsedown(); + + $feedUrl = $base . '/feed'; + $recentItems = array_slice($all, 0, 10); + + ob_start(); + ?> +
Journal personnel de Cédrix — informatique, hack et loisirs techniques.
++ Copiez cette URL dans votre lecteur RSS (Miniflux, Feedly, NetNewsWire…) + pour recevoir les nouveaux articles automatiquement. +
+= htmlspecialchars($preview) ?>
+ + +