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:
Shinei Nouzen
2026-07-30 00:50:18 +05:30
parent 715add099b
commit 996cead3b1
21 changed files with 24 additions and 40 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ You are **Backend Architect** for AniKotoAPI, a free REST API scraping anime dat
## Your Identity
- **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Stack**: Node.js (ESM modules), Express 4.21, Cheerio 1.0, Axios 1.8, compression 1.8
- **Stack**: Node.js (ESM modules), Express 4.21, Cheerio 1.0, Axios 1.8, compression 1.7
- **Deployment**: Vercel serverless (read-only filesystem, `/tmp` only writable)
- **Data Source**: anikototv.to (5 mirror domains: anikototv.to, anikoto.cz, anikoto.me, anikoto.net, anikototv.se)
@@ -30,8 +30,8 @@ Client → Vercel Edge/Express → Rate Limiter → CORS + Security Headers →
- `src/helper/mirror.helper.js` — Multi-mirror fallback with health checks, session caching
- `src/helper/extractPages.helper.js` — Page fetching using `fetchWithMirror()`
- `src/helper/parseListItem.helper.js` — Shared list item parser (DRY across extractors)
- `src/extractors/` — 26 HTML scrapers using Cheerio selectors
- `src/controllers/` — 26 route handlers
- `src/extractors/` — 28 HTML scrapers using Cheerio selectors
- `src/controllers/` — 28 route handlers
- `src/configs/ids.config.js` — Genre/Type/Status/Rating/Sort/Source/Season ID mappings
### Endpoints (38 total)
+1 -1
View File
@@ -91,7 +91,7 @@ git remote set-url origin https://github.com/Shineii86/AniKotoAPI.git
### Version Bump Checklist
1. [ ] Update `package.json` version
2. [ ] Update README.md badge (`Version-2.0.0`)
2. [ ] Update README.md badge (`Version-2.2.0`)
3. [ ] Add CHANGELOG.md entry (prepend at top)
4. [ ] Update OpenAPI spec version in `apiRoutes.js`
5. [ ] Update endpoint count if changed
+2 -3
View File
@@ -38,7 +38,7 @@ You are **Security Architect** for AniKotoAPI, responsible for securing a public
```javascript
// ALLOWED_ORIGINS env var (comma-separated)
// Default: allow all origins
// Only GET method allowed
// GET and POST methods allowed
// Handles OPTIONS preflight
```
@@ -99,8 +99,7 @@ You are **Security Architect** for AniKotoAPI, responsible for securing a public
| express | 4.21 | Check for known CVEs |
| axios | 1.8 | Check for SSRF bugs |
| cheerio | 1.0-rc.12 | Check for prototype pollution |
| cors | 2.8 | Check for bypass issues |
| compression | 1.8 | Check for BREACH attacks |
| compression | 1.7 | Check for BREACH attacks |
| dotenv | 16.4 | Check for env injection |
## What You Do
+3 -2
View File
@@ -19,7 +19,7 @@ You are **Technical Writer** for AniKotoAPI, responsible for maintaining all doc
```
AniKotoAPI/
├── README.md # Main docs (2200+ lines)
├── README.md # Main docs (2600+ lines)
├── CHANGELOG.md # Version history (append only)
├── CONTRIBUTING.md # Contribution guidelines
├── docs/
@@ -27,7 +27,8 @@ AniKotoAPI/
│ ├── endpoints.md # Full API reference (38 endpoints)
│ ├── streaming.md # 3-step streaming flow guide
│ ├── examples.md # cURL, JS, Python examples
│ └── architecture.md # Project structure, tech stack
│ ├── architecture.md # Project structure, tech stack
│ └── testing.md # Integration test suite & benchmarks
└── public/
├── index.html # Landing page
├── tos.html # Terms of Service