fix: Bug fixes from full API diagnostic sweep — all 33 endpoints now 200 OK

- Fix /api/watch 500: correct URL path format (slug/ep-N -> slug/ep-N)
- Fix /api/info: accept both ?id= and ?slug= query params
- Fix /api/status/airing 500: map short status names (ongoing/airing/completed) to correct slugs
- Fix /api/top-rankings: correct selectors (#top-anime .scaff.side.items a.item) + extract rank from rankN class
- Fix /api/completed: correct selectors (section.top-table[data-name='completed'] a.item)
- Fix /api/recently-updated: correct selectors (#recent-update .ani.items .item) + client-side tab filtering
- Fix parseListItem: detect self-as-anchor (<a> elements) + fallback slug extraction
- Fix category extractor: add status name mapping (ongoing->currently-airing, etc.)
- Add /api/cache/stats endpoint for LRU cache diagnostics
- 33 endpoints verified: 0 errors, 0 timeouts
This commit is contained in:
Shinei Nouzen
2026-07-28 20:17:58 +05:30
parent fd29b02158
commit d0432e1654
10 changed files with 86 additions and 74 deletions
+7
View File
@@ -48,6 +48,7 @@ import { getRecentlyUpdatedTabs } from "../controllers/recentlyUpdatedTabs.contr
import { getCompletedAnime } from "../controllers/completedAnime.controller.js";
import { categoryRoutes } from "./category.route.js";
import { getMirrorStatus, resetMirrorCache } from "../helper/mirror.helper.js";
import { getCacheStats } from "../helper/cache.helper.js";
// ══════════════════════════════════════════════════════════════
// ROUTE REGISTRATION
@@ -490,6 +491,12 @@ app.get("/api/mirrors", async (req, res) => {
}
});
// ---- FEATURE: Cache statistics ----
app.get("/api/cache/stats", (req, res) => {
const stats = getCacheStats();
res.json({ success: true, results: stats });
});
// ---- FEATURE: Reset mirror cache ----
app.post("/api/mirrors/reset", (req, res) => {
resetMirrorCache();