Files
RSS-Feed/index.php
T
Harwinder Sekhon ad4dc6b984 Initial commit: RSS feed dashboard aggregating YouTube, Reddit and RT
- PHP 8 + PDO SQLite cache with on-demand TTL refresh and dedup by link hash
- laminas-feed + Guzzle for RSS/Atom parsing and HTTP
- Bootstrap 5 UI with source and time-range filters, AJAX load-more
- User cron-free deployment under Apache/php-fpm; .htaccess hardening
2026-10-05 17:07:48 -04:00

36 lines
943 B
PHP

<?php
declare(strict_types=1);
/** @var array<string, mixed> $app */
$app = require __DIR__ . '/src/bootstrap.php';
$config = $app['config'];
$service = $app['service'];
$refresh = $service->refreshStale();
$sources = $service->sources();
$activeSource = $_GET['source'] ?? null;
if (!is_string($activeSource) || !in_array($activeSource, $sources, true)) {
$activeSource = null;
}
$ranges = $config['ranges'] ?? [];
$activeRange = $_GET['range'] ?? '';
if (!is_string($activeRange) || !array_key_exists($activeRange, $ranges)) {
$activeRange = '';
}
$since = $activeRange !== '' ? gmdate('c', time() - (int) $ranges[$activeRange]) : null;
$page = $service->page($activeSource, 1, (int) $config['page_size'], $since);
echo App\View::render('layout', [
'config' => $config,
'sources' => $sources,
'activeSource' => $activeSource,
'activeRange' => $activeRange,
'page' => $page,
'refresh' => $refresh,
]);