Skip to content

Commit

Permalink
tmp fix for alby limits
Browse files Browse the repository at this point in the history
  • Loading branch information
bumi committed Apr 6, 2024
1 parent a239f23 commit 806e847
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/tokens/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ func Middleware(secret []byte) echo.MiddlewareFunc {
"MaxAccountBalance": claims.MaxAccountBalance,
})
c.Set("UserID", claims.ID)
c.Set("MaxSendVolume", claims.MaxSendVolume)
c.Set("MaxSendAmount", claims.MaxSendAmount)
c.Set("MaxReceiveVolume", claims.MaxReceiveVolume)
c.Set("MaxReceiveAmount", claims.MaxReceiveAmount)
c.Set("MaxAccountBalance", claims.MaxAccountBalance)
// enable it only for getalbycom calls
// there might still be old tokens out there that have these set to 0 (which meant disabled)
if claims.Issuer == "getalbycom" {
c.Set("MaxSendVolume", claims.MaxSendVolume)
c.Set("MaxSendAmount", claims.MaxSendAmount)
c.Set("MaxReceiveVolume", claims.MaxReceiveVolume)
c.Set("MaxReceiveAmount", claims.MaxReceiveAmount)
c.Set("MaxAccountBalance", claims.MaxAccountBalance)
}
// pass UserID to sentry for exception notifications
if hub := sentryecho.GetHubFromContext(c); hub != nil {
hub.Scope().SetUser(sentry.User{ID: strconv.FormatInt(claims.ID, 10)})
Expand Down

0 comments on commit 806e847

Please sign in to comment.