diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-09-01 16:52:37 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-09-01 17:02:18 +0200 |
commit | 3fefb7909ba55d0c8d82a4bf711aac0668a3a38c (patch) | |
tree | b77f9cb09791fbe92cc3a93d1b08c39ee383c843 /app/lib | |
parent | d95dd3883e0c7d1626f5e3b88d24af2627a641e2 (diff) | |
parent | 79305428a7c2bda311bc9d367a84acc28f569522 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `config/webpack/shared.js`: Upstream has changed how Tesseract.js gets included and dropped a dependency. The conflict is caused by glitch-soc having different code due to its theming system. Ported upstream changes. - `lib/mastodon/version.rb`: Upstream refactor/code style change in a place we replaced upstream's repo URL with ours. Ported upstram changes, keeping our repo URL. - `yarn.lock`: Upstream dropped dependencies, one of which was textually too close to a glitch-soc-specific dependency. Not a real conflict.
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activitypub/linked_data_signature.rb | 4 | ||||
-rw-r--r-- | app/lib/entity_cache.rb | 2 | ||||
-rw-r--r-- | app/lib/feed_manager.rb | 2 | ||||
-rw-r--r-- | app/lib/formatter.rb | 2 | ||||
-rw-r--r-- | app/lib/request.rb | 2 | ||||
-rw-r--r-- | app/lib/sidekiq_error_handler.rb | 2 |
6 files changed, 9 insertions, 5 deletions
diff --git a/app/lib/activitypub/linked_data_signature.rb b/app/lib/activitypub/linked_data_signature.rb index f52a8f406..e853a970e 100644 --- a/app/lib/activitypub/linked_data_signature.rb +++ b/app/lib/activitypub/linked_data_signature.rb @@ -27,7 +27,7 @@ class ActivityPub::LinkedDataSignature document_hash = hash(@json.without('signature')) to_be_verified = options_hash + document_hash - if creator.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, Base64.decode64(signature), to_be_verified) + if creator.keypair.public_key.verify(OpenSSL::Digest.new('SHA256'), Base64.decode64(signature), to_be_verified) creator end end @@ -44,7 +44,7 @@ class ActivityPub::LinkedDataSignature to_be_signed = options_hash + document_hash keypair = sign_with.present? ? OpenSSL::PKey::RSA.new(sign_with) : creator.keypair - signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, to_be_signed)) + signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest.new('SHA256'), to_be_signed)) @json.merge('signature' => options.merge('signatureValue' => signature)) end diff --git a/app/lib/entity_cache.rb b/app/lib/entity_cache.rb index afdbd70f2..89cbf8d2c 100644 --- a/app/lib/entity_cache.rb +++ b/app/lib/entity_cache.rb @@ -16,7 +16,7 @@ class EntityCache end def emoji(shortcodes, domain) - shortcodes = [shortcodes] unless shortcodes.is_a?(Array) + shortcodes = Array(shortcodes) cached = Rails.cache.read_multi(*shortcodes.map { |shortcode| to_key(:emoji, shortcode, domain) }) uncached_ids = [] diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 2dc60092c..915f3fa58 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -159,7 +159,7 @@ class FeedManager aggregate = account.user&.aggregates_reblogs? timeline_key = key(:home, account.id) - account.statuses.where.not(visibility: :direct).limit(limit).each do |status| + account.statuses.limit(limit).each do |status| add_to_feed(:home, account.id, status, aggregate) end diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 051f27408..c0f7866bf 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -198,6 +198,7 @@ class Formatter end end + # rubocop:disable Metrics/BlockNesting def encode_custom_emojis(html, emojis, animate = false) return html if emojis.empty? @@ -252,6 +253,7 @@ class Formatter html end + # rubocop:enable Metrics/BlockNesting def rewrite(text, entities, keep_html = false) text = text.to_s diff --git a/app/lib/request.rb b/app/lib/request.rb index bcba1eebf..89fbeaf95 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -114,7 +114,7 @@ class Request def signature algorithm = 'rsa-sha256' - signature = Base64.strict_encode64(@keypair.sign(OpenSSL::Digest::SHA256.new, signed_string)) + signature = Base64.strict_encode64(@keypair.sign(OpenSSL::Digest.new('SHA256'), signed_string)) "keyId=\"#{key_id}\",algorithm=\"#{algorithm}\",headers=\"#{signed_headers.keys.join(' ').downcase}\",signature=\"#{signature}\"" end diff --git a/app/lib/sidekiq_error_handler.rb b/app/lib/sidekiq_error_handler.rb index b07817d45..ab555b1be 100644 --- a/app/lib/sidekiq_error_handler.rb +++ b/app/lib/sidekiq_error_handler.rb @@ -17,8 +17,10 @@ class SidekiqErrorHandler private + # rubocop:disable Naming/MethodParameterName def limit_backtrace_and_raise(e) e.set_backtrace(e.backtrace.first(BACKTRACE_LIMIT)) raise e end + # rubocop:enable Naming/MethodParameterName end |