omg-actionpack 8.0.0.alpha4 → 8.0.0.alpha8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/lib/action_controller/metal/rate_limiting.rb +12 -4
- data/lib/action_pack/gem_version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25af50ef776cddbe4644faf9005396c435dc06ab1a96f9d36804d3e403d81551
|
4
|
+
data.tar.gz: 22e5847f38d2bc79e75ac4a8c9f974a11aae7124843ec3a0c9f54760d0f3ff14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19a2eab60987fc7ac73e9016a597f6ad455c5ad8c6263467170a599cef43c4e190f3bcb2fecb29b68c316042c551549d5cd243130e262a26c6668747ecc12851
|
7
|
+
data.tar.gz: 78c5eefefc12807643fe1d0ba218b3311666fb3761e9131c8b6d282783655c790203f003fa71a019f7c7183d8550e95d778ba2c2bc82383c58d9bb7d917d2417
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## Rails 8.0.0.alpha8 (September 18, 2024) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 8.0.0.alpha7 (September 18, 2024) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 8.0.0.alpha6 (September 18, 2024) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 8.0.0.alpha5 (September 18, 2024) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 8.0.0.alpha5 (September 18, 2024) ##
|
22
|
+
|
23
|
+
* No changes.
|
24
|
+
|
25
|
+
|
26
|
+
## Rails 8.0.0.alpha4 (September 18, 2024) ##
|
27
|
+
|
28
|
+
* No changes.
|
29
|
+
|
30
|
+
|
1
31
|
## Rails 8.0.0.alpha4 (September 18, 2024) ##
|
2
32
|
|
3
33
|
* No changes.
|
@@ -29,6 +29,9 @@ module ActionController # :nodoc:
|
|
29
29
|
# datastore as your general caches, you can pass a custom store in the `store`
|
30
30
|
# parameter.
|
31
31
|
#
|
32
|
+
# If you want to use multiple rate limits per controller, you need to give each of
|
33
|
+
# them and explicit name via the `name:` option.
|
34
|
+
#
|
32
35
|
# Examples:
|
33
36
|
#
|
34
37
|
# class SessionsController < ApplicationController
|
@@ -44,14 +47,19 @@ module ActionController # :nodoc:
|
|
44
47
|
# RATE_LIMIT_STORE = ActiveSupport::Cache::RedisCacheStore.new(url: ENV["REDIS_URL"])
|
45
48
|
# rate_limit to: 10, within: 3.minutes, store: RATE_LIMIT_STORE
|
46
49
|
# end
|
47
|
-
|
48
|
-
|
50
|
+
#
|
51
|
+
# class SessionsController < ApplicationController
|
52
|
+
# rate_limit to: 3, within: 2.seconds, name: "short-term"
|
53
|
+
# rate_limit to: 10, within: 5.minutes, name: "long-term"
|
54
|
+
# end
|
55
|
+
def rate_limit(to:, within:, by: -> { request.remote_ip }, with: -> { head :too_many_requests }, store: cache_store, name: controller_path, **options)
|
56
|
+
before_action -> { rate_limiting(to: to, within: within, by: by, with: with, store: store, name: name) }, **options
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
52
60
|
private
|
53
|
-
def rate_limiting(to:, within:, by:, with:, store:)
|
54
|
-
count = store.increment("rate-limit:#{
|
61
|
+
def rate_limiting(to:, within:, by:, with:, store:, name:)
|
62
|
+
count = store.increment("rate-limit:#{name}:#{instance_exec(&by)}", 1, expires_in: within)
|
55
63
|
if count && count > to
|
56
64
|
ActiveSupport::Notifications.instrument("rate_limit.action_controller", request: request) do
|
57
65
|
instance_exec(&with)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omg-actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.0.
|
4
|
+
version: 8.0.0.alpha8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 8.0.0.
|
19
|
+
version: 8.0.0.alpha8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 8.0.0.
|
26
|
+
version: 8.0.0.alpha8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,28 +128,28 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 8.0.0.
|
131
|
+
version: 8.0.0.alpha8
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 8.0.0.
|
138
|
+
version: 8.0.0.alpha8
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: omg-activemodel
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 8.0.0.
|
145
|
+
version: 8.0.0.alpha8
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 8.0.0.
|
152
|
+
version: 8.0.0.alpha8
|
153
153
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
154
154
|
testing MVC web applications. Works with any Rack-compatible server.
|
155
155
|
email: david@loudthinking.com
|
@@ -347,10 +347,10 @@ licenses:
|
|
347
347
|
- MIT
|
348
348
|
metadata:
|
349
349
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
350
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.
|
351
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.0.
|
350
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.alpha8/actionpack/CHANGELOG.md
|
351
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.0.alpha8/
|
352
352
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
353
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.
|
353
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.alpha8/actionpack
|
354
354
|
rubygems_mfa_required: 'true'
|
355
355
|
post_install_message:
|
356
356
|
rdoc_options: []
|
@@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
368
368
|
version: '0'
|
369
369
|
requirements:
|
370
370
|
- none
|
371
|
-
rubygems_version: 3.5.
|
371
|
+
rubygems_version: 3.5.16
|
372
372
|
signing_key:
|
373
373
|
specification_version: 4
|
374
374
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|