mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
catch authorization error in rate limiter and 5 rpm
This commit is contained in:
parent
b7c133d58e
commit
74f2dd6bf1
1 changed files with 7 additions and 2 deletions
|
|
@ -103,8 +103,13 @@ export const createApp = (): {
|
|||
max: async (req) => {
|
||||
// 100 RPM for an authenticated request, 5 for a non-authenticated request
|
||||
const token = getTokenByRequest(req)
|
||||
const claims = await getClaimsByToken(token)
|
||||
return claims ? 100 : 5
|
||||
try {
|
||||
const claims = await getClaimsByToken(token)
|
||||
return claims ? 100 : 5
|
||||
} catch (e) {
|
||||
console.log('non-authenticated request')
|
||||
return 5
|
||||
}
|
||||
},
|
||||
keyGenerator: (req) => {
|
||||
return getTokenByRequest(req) || req.ip
|
||||
|
|
|
|||
Loading…
Reference in a new issue