Skip to content

Commit b4eb03d

Browse files
committed
fix: Adjust rate limiting and remove unused field in User Progression API
- Updated the rate limiting for public requests to a maximum of 10 requests per minute. - Removed the unused triggerEvent field from the sanitized progression data to streamline the response.
1 parent 3f78c71 commit b4eb03d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

api/userProgression.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function sanitizeProgression(progression, isPublic = false) {
2323
xpRank: stat.xpRank,
2424
elo: stat.elo,
2525
eloRank: stat.eloRank,
26-
triggerEvent: stat.triggerEvent,
2726
// Calculated fields
2827
xpGain: stat.xpGain || 0,
2928
eloChange: stat.eloChange || 0,
@@ -55,13 +54,13 @@ export default async function handler(req, res) {
5554

5655
// Determine if this is a public (username-based) or authenticated (userId-based) request
5756
const { userId, username } = req.body;
58-
const isPublicRequest = !userId && !!username;
57+
const isPublicRequest = true
5958

6059
// Apply stricter rate limiting for public requests
6160
// Public: 5 requests per minute per IP
6261
// Authenticated: 20 requests per minute per IP
6362
const limiter = rateLimit({
64-
max: isPublicRequest ? 5 : 20,
63+
max: 10,
6564
windowMs: 60000,
6665
message: 'Too many requests. Please try again later.'
6766
});

0 commit comments

Comments
 (0)