chore(*): remove duplicate cache rule + cleanup cache headers; cleanup + formatting

This commit is contained in:
Cory Dransfeldt 2025-05-17 13:25:40 -07:00
parent 425fed6ff6
commit 0e565970a5
No known key found for this signature in database
42 changed files with 223 additions and 217 deletions

View file

@ -18,6 +18,7 @@ class LatestListenHandler extends BaseHandler
{
try {
$cachedData = $this->cache ? $this->cache->get("latest_listen") : null;
if ($cachedData) {
$this->sendResponse(json_decode($cachedData, true));
return;
@ -41,17 +42,14 @@ class LatestListenHandler extends BaseHandler
$this->sendResponse($latestListen);
} catch (\Exception $e) {
error_log("LatestListenHandler Error: " . $e->getMessage());
$this->sendErrorResponse(
"Internal Server Error: " . $e->getMessage(),
500
);
$this->sendErrorResponse("Internal Server Error: " . $e->getMessage(), 500);
}
}
private function formatLatestListen(array $latestListen): array
{
$emoji =
$latestListen["artist_emoji"] ?? ($latestListen["genre_emoji"] ?? "🎧");
$emoji = $latestListen["artist_emoji"] ?? ($latestListen["genre_emoji"] ?? "🎧");
$trackName = htmlspecialchars(
$latestListen["track_name"] ?? "Unknown Track",
ENT_QUOTES,