Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `README.md`:
  Minor upstream change, our README is completely different.
  Kept ours.
- `lib/tasks/assets.rake`:
  glitch-soc has extra code to deal with its theming system,
  upstream changed a line that exists in glitch-soc.
  Applied upstream changes.
This commit is contained in:
Claire
2023-02-09 12:46:12 +01:00
216 changed files with 767 additions and 324 deletions

View File

@@ -53,7 +53,7 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService
status.id
rescue ActiveRecord::RecordInvalid => e
Rails.logger.debug "Invalid pinned status #{uri}: #{e.message}"
Rails.logger.debug { "Invalid pinned status #{uri}: #{e.message}" }
nil
end

View File

@@ -6,7 +6,7 @@ class ActivityPub::FetchRemoteAccountService < ActivityPub::FetchRemoteActorServ
actor = super
return actor if actor.nil? || actor.is_a?(Account)
Rails.logger.debug "Fetching account #{uri} failed: Expected Account, got #{actor.class.name}"
Rails.logger.debug { "Fetching account #{uri} failed: Expected Account, got #{actor.class.name}" }
raise Error, "Expected Account, got #{actor.class.name}" unless suppress_errors
end
end

View File

@@ -38,7 +38,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
ActivityPub::ProcessAccountService.new.call(@username, @domain, @json, only_key: only_key, verified_webfinger: !only_key, request_id: request_id)
rescue Error => e
Rails.logger.debug "Fetching actor #{uri} failed: #{e.message}"
Rails.logger.debug { "Fetching actor #{uri} failed: #{e.message}" }
raise unless suppress_errors
end

View File

@@ -38,7 +38,7 @@ class ActivityPub::FetchRemoteKeyService < BaseService
find_actor(owner_uri, @owner, suppress_errors)
rescue Error => e
Rails.logger.debug "Fetching key #{uri} failed: #{e.message}"
Rails.logger.debug { "Fetching key #{uri} failed: #{e.message}" }
raise unless suppress_errors
end

View File

@@ -11,7 +11,7 @@ class ActivityPub::ProcessCollectionService < BaseService
begin
@json = compact(@json) if @json['signature'].is_a?(Hash)
rescue JSON::LD::JsonLdError => e
Rails.logger.debug "Error when compacting JSON-LD document for #{value_or_id(@json['actor'])}: #{e.message}"
Rails.logger.debug { "Error when compacting JSON-LD document for #{value_or_id(@json['actor'])}: #{e.message}" }
@json = original_json.without('signature')
end
@@ -71,8 +71,8 @@ class ActivityPub::ProcessCollectionService < BaseService
@account = ActivityPub::LinkedDataSignature.new(@json).verify_actor!
@account = nil unless @account.is_a?(Account)
@account
rescue JSON::LD::JsonLdError => e
Rails.logger.debug "Could not verify LD-Signature for #{value_or_id(@json['actor'])}: #{e.message}"
rescue JSON::LD::JsonLdError, RDF::WriterError => e
Rails.logger.debug { "Could not verify LD-Signature for #{value_or_id(@json['actor'])}: #{e.message}" }
nil
end
end

View File

@@ -94,7 +94,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
@next_media_attachments << media_attachment
rescue Addressable::URI::InvalidURIError => e
Rails.logger.debug "Invalid URL in attachment: #{e}"
Rails.logger.debug { "Invalid URL in attachment: #{e}" }
end
end

View File

@@ -30,7 +30,7 @@ class FetchLinkCardService < BaseService
attach_card if @card&.persisted?
rescue HTTP::Error, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e
Rails.logger.debug "Error fetching link #{@original_url}: #{e}"
Rails.logger.debug { "Error fetching link #{@original_url}: #{e}" }
nil
end

View File

@@ -82,7 +82,7 @@ class FetchOEmbedService
return if @endpoint_url.blank?
body = Request.new(:get, @endpoint_url).perform do |res|
res.code != 200 ? nil : res.body_with_limit
res.code == 200 ? res.body_with_limit : nil
end
validate(parse_for_format(body)) if body.present?

View File

@@ -12,7 +12,7 @@ class FetchResourceService < BaseService
process(url)
rescue HTTP::Error, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e
Rails.logger.debug "Error fetching resource #{@url}: #{e}"
Rails.logger.debug { "Error fetching resource #{@url}: #{e}" }
nil
end

View File

@@ -58,7 +58,7 @@ class Keys::ClaimService < BaseService
@result = Result.new(@target_account, @device_id, key_id: json['id'], key: json['publicKeyBase64'], signature: json.dig('signature', 'signatureValue'))
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error => e
Rails.logger.debug "Claiming one-time key for #{@target_account.acct}:#{@device_id} failed: #{e}"
Rails.logger.debug { "Claiming one-time key for #{@target_account.acct}:#{@device_id} failed: #{e}" }
nil
end

View File

@@ -73,7 +73,7 @@ class Keys::QueryService < BaseService
Device.new(device_id: device['id'], name: device['name'], identity_key: device.dig('identityKey', 'publicKeyBase64'), fingerprint_key: device.dig('fingerprintKey', 'publicKeyBase64'), claim_url: device['claim'])
end
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error => e
Rails.logger.debug "Querying devices for #{@account.acct} failed: #{e}"
Rails.logger.debug { "Querying devices for #{@account.acct} failed: #{e}" }
nil
end
end

View File

@@ -54,7 +54,7 @@ class ResolveAccountService < BaseService
fetch_account!
rescue Webfinger::Error => e
Rails.logger.debug "Webfinger query for #{@uri} failed: #{e}"
Rails.logger.debug { "Webfinger query for #{@uri} failed: #{e}" }
raise unless @options[:suppress_errors]
end

View File

@@ -11,7 +11,7 @@ class VerifyLinkService < BaseService
field.mark_verified!
rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, IPAddr::AddressFamilyError => e
Rails.logger.debug "Error fetching link #{@url}: #{e}"
Rails.logger.debug { "Error fetching link #{@url}: #{e}" }
nil
end
@@ -19,7 +19,7 @@ class VerifyLinkService < BaseService
def perform_request!
@body = Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
res.code != 200 ? nil : res.body_with_limit
res.code == 200 ? res.body_with_limit : nil
end
end