feat(v2.3.0): self-healing fallback system — auto-recovery from Cloudflare blocks

pipe.js now tries 3 methods in order with automatic fallback:
1. Direct — mirror rotation (.ru → .to → .bz → .tv) with browser headers
2. ScraperAPI — free proxy (1K req/mo, no CC required)
3. FlareSolverr — self-hosted browser proxy (solves Cloudflare Turnstile)

When one method fails (403/timeout), the next is tried automatically.
Zero-config: works without any env vars. Add SCRAPER_API_KEY or
FLARESOLVERR_URL for Cloudflare bypass.

New endpoint: /api/pipe-health — tests all configured methods,
reports latency and working/failed status, recommends preferred method.

Files changed:
- src/helpers/pipe.js — methodDirect(), methodScraperAPI(), methodFlareSolverr(), pipeHealthCheck()
- src/routes/apiRoutes.js — added /api/pipe-health endpoint
- .env.example — documented SCRAPER_API_KEY, FLARESOLVERR_URL

Version bumped to 2.3.0 across package.json, server.js, /api/health,
/api/openapi, public/openapi.json. CHANGELOG updated.
This commit is contained in:
Shinei Nouzen
2026-07-02 07:12:06 +05:30
parent 92154d7ea2
commit eb0e166310
7 changed files with 297 additions and 320 deletions
+17 -2
View File
@@ -1,13 +1,28 @@
# Origins you want to allow (comma-separated, use * for all)
ALLOWED_ORIGINS=https://miruro.tv,https://miruro.to,https://miruro.bz
ALLOWED_ORIGINS=https://miruro.tv,https://miruro.to,https://miruro.bz,https://miruro.ru
# Port (optional, defaults to 3000)
PORT=3000
# Pipe XOR obfuscation key (hex string, 32 chars)
# Required for pipe response decoding
# Required for pipe response decoding (x-obfuscated: 2)
PIPE_OBF_KEY=71951034f8fbcf53d89db52ceb3dc22c
# PRU proxy XOR key (hex string, 32 chars)
# Required for pru.ultracloud.cc URL encoding/decoding
PRU_PROXY_KEY=a54d389c18527d9fd3e7f0643e27edbe
# ══════════════════════════════════════════════════════════════
# SELF-HEALING FALLBACK METHODS (optional, enables auto-recovery)
# ══════════════════════════════════════════════════════════════
# Method 2: ScraperAPI (free 1,000 req/month, no CC needed)
# Sign up at https://www.scraperapi.com/
# Enables automatic fallback when direct requests are blocked by Cloudflare
SCRAPER_API_KEY=
# Method 3: FlareSolverr (self-hosted browser proxy)
# Run: docker run -p 8191:8191 ghcr.io/flaresolverr/flaresolverr
# Deploy on Render.com free tier, Oracle Cloud, or any VPS
# Solves Cloudflare Turnstile challenges automatically
FLARESOLVERR_URL=