Add: 絵文字リアクションのレートリミット (#575)

This commit is contained in:
KMY(雪あすか) 2024-02-17 10:42:34 +09:00 committed by GitHub
parent 7411941885
commit 9a3c8c5bda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -14,6 +14,11 @@ class RateLimiter
period: 3.hours.freeze,
}.freeze,
emoji_reactions: {
limit: 300,
period: 3.hours.freeze,
}.freeze,
reports: {
limit: 400,
period: 24.hours.freeze,

View file

@ -16,11 +16,14 @@
class EmojiReaction < ApplicationRecord
include Paginable
include RateLimitable
EMOJI_REACTION_LIMIT = 32_767
EMOJI_REACTION_PER_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_ACCOUNT_LIMIT', 3).to_i
EMOJI_REACTION_PER_REMOTE_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_REMOTE_ACCOUNT_LIMIT', 3).to_i
rate_limit by: :account, family: :emoji_reactions
update_index('statuses', :status)
scope :local, -> { where(uri: nil) }