fix: resolve Issue #3 — API stability, error handling & new endpoints

- Added /api/sources/:id path-based endpoint for streaming sources
- Improved Cloudflare detection with proper 503 status codes
- Added timeout handling (15s) with exponential backoff for pipe requests
- Enhanced CORS with Authorization header and rate limit expose headers
- All streaming endpoints now return descriptive error messages
- Pipe health check reports skipped/unconfigured methods separately
- Updated OpenAPI spec with new /sources/{id} route
- Version bumped to 2.3.3

Fixed endpoints: /search, /info/:id, /trending, /filter, /episodes/:id,
/sources/:id (new), /stream, /watch, /download
All endpoints return consistent { success, results/message } format
Proper 400/404/503 responses for invalid inputs and failures
This commit is contained in:
Shinei Nouzen
2026-08-25 06:45:38 +05:30
parent 160f83acf7
commit a5fbace9c1
7 changed files with 142 additions and 22 deletions
+3 -1
View File
@@ -82,6 +82,8 @@ const tests = [
// ---- FEATURE: Streaming endpoints ----
{ name: "Episodes", url: "/episodes/20" },
{ name: "Batch Episodes", url: "/episodes/20/batch?provider=kiwi&category=sub&slugs=animepahe-1,animepahe-2" },
{ name: "Sources (query)", url: "/sources?episodeId=test&provider=kiwi&anilistId=20" },
{ name: "Sources (path)", url: "/sources/test?provider=kiwi&anilistId=20" },
{ name: "Stream", url: "/stream?provider=kiwi&anilistId=20&category=sub&slug=animepahe-1" },
{ name: "Download", url: "/download?provider=kiwi&anilistId=20&category=sub&slug=animepahe-1" },
{ name: "Watch", url: "/watch/kiwi/20/sub/animepahe-1" },
@@ -152,7 +154,7 @@ async function runTest(test) {
* API_URL=http://localhost:3000/api node test.js # Run against local
*/
async function runAll() {
console.log(`\n🧪 MiruroAPI v2.3.0 — Running ${tests.length} tests...\n`);
console.log(`\n🧪 MiruroAPI v2.3.3 — Running ${tests.length} tests...\n`);
// NOTE: Sequential execution — parallel requests would hit rate limiter
for (const test of tests) {