Expire live caption state after inactivity and tune stream limits

This commit is contained in:
Adolfo Reyna
2026-02-28 21:51:28 -05:00
parent 8aa1f3addd
commit 5195317c0c
2 changed files with 34 additions and 3 deletions
+1
View File
@@ -29,6 +29,7 @@ const limiter = rateLimit({
limit: 500, // Limit each IP to 100 requests per `window` (here, per 15 minutes).
standardHeaders: 'draft-8', // draft-6: `RateLimit-*` headers; draft-7 & draft-8: combined `RateLimit` header
legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
skip: (req) => req.path.startsWith("/live-captions"),
keyGenerator: (req) => {
const forwarded = req.headers["x-forwarded-for"]?.split(",")[0]; // Take the first IP in the list
const ip = forwarded || req.ip; // Fallback to req.ip