mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 02:45:10 +00:00
fix: Full diagnostic sweep — bugs, dead code, unused imports, docs accuracy
Code fixes: - seasons/watchOrder: Remove dead ternary (both branches identical) - mirror.helper: Remove redundant ternary (both branches identical) - topAnimeRankings: Fix JSDoc (day/week/month, not top/newest) - apiRoutes: Fix proxy domain validation (exact match, not includes) - apiRoutes: Fix proxy .m3u8 check (pathname, not hostname) - pagination: Fix totalItems calculation (was overestimating) - server.js: Remove dead has404File variable - server.js: Remove duplicate /api/cache/stats route - server.js: Remove unused getCacheStats import Unused imports removed: - animeInfo: URLS from dataUrl.js - episodeList: headers from header.config.js - episodeListAjax: axios - trending: URLS from dataUrl.js - trendingSidebar: URLS from dataUrl.js - upcomingAnime: parseListItems - watchPage: URLS, BASE_URL from dataUrl.js Docs fixes: - README: 33->38 endpoints, 24->28 controllers, 26->28 extractors - README: Cache TTL 5min->per-endpoint, Timeout 15s->30s - docs/index.md: 33->38 endpoints - architecture.md: LRU cache strategy, remove stale cookie-parser - agents: compression version, extractor/controller counts - agents: domain typo, stale CORS dep, version badge
This commit is contained in:
@@ -25,7 +25,6 @@ import crypto from "crypto";
|
||||
import { fileURLToPath } from "url";
|
||||
import { dirname } from "path";
|
||||
import { createApiRoutes } from "./src/routes/apiRoutes.js";
|
||||
import { getCacheStats } from "./src/helper/cache.helper.js";
|
||||
import { addCreatorInfo } from "./src/middleware/creatorInfo.js";
|
||||
|
||||
dotenv.config();
|
||||
@@ -39,7 +38,6 @@ const PORT = process.env.PORT || 4444;
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const publicDir = path.join(process.cwd(), "public");
|
||||
const has404File = fs.existsSync(path.join(publicDir, "404.html"));
|
||||
const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(",");
|
||||
|
||||
// ---- FEATURE: Response compression ----
|
||||
@@ -188,11 +186,6 @@ app.use((req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
// ---- FEATURE: Cache stats endpoint ----
|
||||
app.get("/api/cache/stats", (req, res) => {
|
||||
res.json({ success: true, results: getCacheStats() });
|
||||
});
|
||||
|
||||
// ---- FEATURE: Creator info middleware (injects attribution into all responses) ----
|
||||
app.use(addCreatorInfo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user