v1.4.0: Fix Vercel deployment, security headers, rate limiter, cache cleanup

This commit is contained in:
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ
2026-06-25 00:52:26 +05:30
parent 68f7ea7cf4
commit 3a28c4d182
7 changed files with 42 additions and 15 deletions
+9
View File
@@ -104,6 +104,15 @@ const setCache = (key, data, ttl = DEFAULT_TTL) => {
cache.delete(firstKey);
}
// NOTE: Periodic cleanup — prune all expired entries when cache reaches 80% capacity
// Prevents unbounded memory growth from stale entries that were never accessed
if (cache.size >= MAX_CACHE_SIZE * 0.8) {
const now = Date.now();
for (const [k, v] of cache) {
if (now > v.expiry) cache.delete(k);
}
}
cache.set(key, { data, expiry: Date.now() + ttl });
};
+2 -2
View File
@@ -355,7 +355,7 @@ const createApiRoutes = (jsonResponse, jsonError) => {
success: true,
results: {
status: "healthy",
version: "1.2.0",
version: "1.4.0",
uptime: `${hours}h ${minutes}m ${seconds}s`,
uptimeSeconds: uptime,
timestamp: new Date().toISOString(),
@@ -404,7 +404,7 @@ const createApiRoutes = (jsonResponse, jsonError) => {
info: {
title: "MiruroAPI",
description: "Free REST API for anime streaming data — AniList GraphQL + Miruro streaming providers",
version: "1.2.0",
version: "1.4.0",
contact: { name: "Shineii86", url: "https://github.com/Shineii86/MiruroAPI" },
},
servers: [