diff --git a/api_v1_rss.php b/api_v1_rss.php index 497df23..eba4996 100644 --- a/api_v1_rss.php +++ b/api_v1_rss.php @@ -57,7 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($ts > $last_fetch) $last_fetch = $ts; } } - if (time() - $last_fetch < 300) { // 5 minutes + if (time() - $last_fetch < 120) { // 2 minutes to match JS echo json_encode(['success' => true, 'new_items' => 0, 'skipped' => true]); exit; } @@ -80,9 +80,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { foreach ($items as $item) { $guid = (string)($item->guid ?? ($item->id ?? $item->link)); + if (empty($guid) && isset($item->link['href'])) { + $guid = (string)$item->link['href']; + } + $title = (string)$item->title; $link = (string)($item->link['href'] ?? $item->link); - $description = strip_tags((string)($item->description ?? $item->summary)); + if (empty($link) && isset($item->link)) { + foreach($item->link as $l) { + if ($l['rel'] == 'alternate' || !$l['rel']) { + $link = (string)$l['href']; + break; + } + } + } + + $description = (string)($item->description ?? ($item->summary ?? $item->content)); + $description = strip_tags($description); // Extract additional fields $category = (string)($item->category ?? ($item->category['term'] ?? '')); diff --git a/assets/js/main.js b/assets/js/main.js index a531286..5020da2 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1413,7 +1413,7 @@ document.addEventListener('DOMContentLoaded', () => { const autoSyncRss = async () => { // Check if we are in an announcement channel // We can look for the bullhorn icon in the header - const headerIcon = document.querySelector('.main-header i.fa-bullhorn'); + const headerIcon = document.querySelector('.chat-header i.fa-bullhorn'); if (headerIcon) { const formData = new FormData(); formData.append('action', 'sync'); diff --git a/requests.log b/requests.log index fa08195..5ed9ed9 100644 --- a/requests.log +++ b/requests.log @@ -399,3 +399,9 @@ 2026-02-16 23:36:54 - GET /index.php?server_id=1&channel_id=12 - POST: [] 2026-02-16 23:37:08 - GET /index.php?server_id=1&channel_id=12 - POST: [] 2026-02-16 23:37:26 - GET /index.php?server_id=1&channel_id=12 - POST: [] +2026-02-16 23:39:35 - GET /?fl_project=38443 - POST: [] +2026-02-16 23:39:49 - GET /index.php?server_id=1&channel_id=12 - POST: [] +2026-02-16 23:39:52 - GET /index.php?server_id=1&channel_id=1 - POST: [] +2026-02-16 23:39:53 - GET /index.php?server_id=1&channel_id=12 - POST: [] +2026-02-16 23:40:18 - GET /index.php?server_id=1&channel_id=17 - POST: [] +2026-02-16 23:40:19 - GET /index.php?server_id=1&channel_id=12 - POST: []