v-fixed43: 提高每IP限流阈值(api 10000/min, live 1000/min)避免正常用户触发Too Many Requests

This commit is contained in:
jinghui committed 2026-11-01 11:06:54 +08:00
1 parent 1a5f53350c
commit 0300d6b09d
1 file changed
+2 -2
+2 -2
View File
@@ -60,7 +60,7 @@ function writeChecked(p, s) {
" e.n++;",
' const isLive = u.indexOf("/api/tvbox") === 0 && /live=(ts|m3u8|lines|ch)/.test(u);',
" if (isLive) e.live++;",
" if (e.n > 240 || (isLive && e.live > 30)) {",
" if (e.n > 10000 || (isLive && e.live > 1000)) {",
' console.log("[RATE] 429 ip=" + ip + " n=" + e.n + " live=" + e.live + " " + u.slice(0, 60));',
' res.writeHead(429, { "Content-Type": "text/plain; charset=utf-8", "Retry-After": "60" });',
' res.end("Too Many Requests");',
@@ -69,7 +69,7 @@ function writeChecked(p, s) {
" } catch (err) {}",
" for (let i = 0; i < __origReq.length; i++) __origReq[i](req, res);",
" });",
' console.log("[RATE] per-ip limiter on (api=240/min, live=30/min)");',
' console.log("[RATE] per-ip limiter on (api=10000/min, live=1000/min)");',
' } catch (e) { console.log("[RATE] init-err", e && e.message); }',
" // <<< RATE-LIMIT-V1"
].join("\n");