discourse/spec
Alan Guo Xiang Tan 859d61003e
DEV: API to register custom request rate limiting conditions (#30239)
This commit adds the `add_request_rate_limiter` plugin API which allows plugins to add custom rate limiters on top of the default rate limiters which requests by a user's id or the request's IP address.

Example to add a rate limiter that rate limits all requests from Googlebot under the same rate limit bucket:

```
add_request_rate_limiter(
  identifier: :country,
  key: ->(request) { "country/#{DiscourseIpInfo.get(request.ip)[:country]}" },
  activate_when: ->(request) { DiscourseIpInfo.get(request.ip)[:country].present? },
)
```
2024-12-23 09:57:18 +08:00
..
fabricators
fixtures
generator
helpers
import_export
initializers
integration
integrity
jobs FIX: we introduced a Jobs::UserEmail which broke consistency checks (#30409) 2024-12-22 21:33:47 +11:00
lib DEV: API to register custom request rate limiting conditions (#30239) 2024-12-23 09:57:18 +08:00
mailers
migrations
models
multisite DEV: API to register custom request rate limiting conditions (#30239) 2024-12-23 09:57:18 +08:00
requests DEV: API to register custom request rate limiting conditions (#30239) 2024-12-23 09:57:18 +08:00
script/import_scripts
serializers FIX: more... should not show when there are no visible links (#30405) 2024-12-21 01:06:46 +01:00
services
support
system
tasks
views
rails_helper.rb
regenerate_swagger_docs
swagger_helper.rb