From 42fa8304ddb811b0f725f245130f70c0f5e86a6c Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 04 Nov 2025 06:12:02 +0000
Subject: [PATCH] =Refactored LoginManager to be more extensible and configurable, as well as an AjaxRateLimiter

---
 inc/rest/routes/FeedRoutes.php |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/inc/rest/routes/FeedRoutes.php b/inc/rest/routes/FeedRoutes.php
index eb7024e..90993b4 100644
--- a/inc/rest/routes/FeedRoutes.php
+++ b/inc/rest/routes/FeedRoutes.php
@@ -319,6 +319,20 @@
 
         error_log('Final Args: '.print_r($args, true));
 
+		// Determine content type(s) for cache checking
+		$content_types = [];
+		if (!empty($data['content'])) {
+			$content_types[] = $data['content'];
+		}
+		if (!empty($data['type'])) {
+			$types = is_array($data['type']) ? $data['type'] : [$data['type']];
+			$content_types = array_merge($content_types, $types);
+		}
+		// Check HTTP cache headers first
+		$cache_check = $this->checkHeaders($request, $content_types ?: ['feed']);
+		if ($cache_check) {
+			return $cache_check; // Returns 304 Not Modified
+		}
 
         $key = $this->cache->generateKey($args);
         $cached = $this->cache->get($key);
@@ -328,7 +342,8 @@
                 $args['highlight'] = $highlight;
             }
             $cached['items'] = $this->processHighlightedItem($cached['items'], $args);
-            return new WP_REST_Response($cached);
+            $response = new WP_REST_Response($cached);
+			return $this->addCacheHeaders($response);
         }
         // Fetch and format items
         $items = $this->fetchFeedItems($args);
@@ -343,7 +358,8 @@
         }
 
         $items['items'] = $this->processHighlightedItem($items['items'], $args);
-        return new WP_REST_Response($items);
+		$response = new WP_REST_Response($items);
+		return $this->addCacheHeaders($response);
     }
 
     /**

--
Gitblit v1.10.0