diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-03-02 16:33:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 16:33:06 +0100 |
commit | f4abf8e7829c6a5b952dea6fb9ad01b6b3601f95 (patch) | |
tree | afc41f393d862885eae63cccd3b72262ce08128b /config/initializers | |
parent | 4aa860b65bd796b09dc0ceffa1fdd7de31060a34 (diff) | |
parent | 7336276252ab89985c609359eb9953fca0383db3 (diff) |
Merge pull request #1504 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
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) |