diff options
author | Starfall <us@starfall.systems> | 2021-03-04 23:55:42 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2021-03-04 23:55:42 -0600 |
commit | fe6381b9acc28cd610b032160de2952e1fdefc86 (patch) | |
tree | ad1ba10427d5d792d3ba797479528f01e51404a5 /config/initializers | |
parent | 033b1b5b900babc9b068ddad0ae644c5f15e9ffe (diff) | |
parent | f4abf8e7829c6a5b952dea6fb9ad01b6b3601f95 (diff) |
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/rack_attack.rb | 8 | ||||
-rw-r--r-- | config/initializers/twitter_regex.rb | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index c0db49907..2a6cca7dc 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -94,11 +94,15 @@ class Rack::Attack end throttle('throttle_email_confirmations/ip', limit: 25, period: 5.minutes) do |req| - req.remote_ip if req.post? && req.path == '/auth/confirmation' + req.remote_ip if req.post? && %w(/auth/confirmation /api/v1/emails/confirmations).include?(req.path) end throttle('throttle_email_confirmations/email', limit: 5, period: 30.minutes) do |req| - req.params.dig('user', 'email').presence if req.post? && req.path == '/auth/password' + if req.post? && req.path == '/auth/password' + req.params.dig('user', 'email').presence + elsif req.post? && req.path == '/api/v1/emails/confirmations' + req.authenticated_user_id + end end throttle('throttle_login_attempts/ip', limit: 25, period: 5.minutes) do |req| diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb index aca85dd43..3ff2aa9e5 100644 --- a/config/initializers/twitter_regex.rb +++ b/config/initializers/twitter_regex.rb @@ -1,4 +1,10 @@ -module Twitter +module Twitter::TwitterText + class Configuration + def emoji_parsing_enabled + false + end + end + class Regex REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}<>\(\)\?]/iou REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*"'「」<>;:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou @@ -79,7 +85,7 @@ module Twitter return [] unless text && text.index(":") urls = [] - text.to_s.scan(Twitter::Regex[:valid_extended_uri]) do + text.to_s.scan(Twitter::TwitterText::Regex[:valid_extended_uri]) do valid_uri_match_data = $~ start_position = valid_uri_match_data.char_begin(3) |