Merge branch 'master' into glitch-soc/master
Conflicts: - `config/locales/en.yml` No real conflict, upstream added a translatable string “too close” to one specific to glitch-soc - `lib/mastodon/statuses_cli.rb` Fixes made upstream, while changed in glitch-soc to keep bookmarked statuses - `package.json` No real conflict, additional dependency in glitch-soc
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
require 'rubygems/package'
|
||||
|
||||
class BackupService < BaseService
|
||||
include Payloadable
|
||||
|
||||
attr_reader :account, :backup, :collection
|
||||
|
||||
def call(backup)
|
||||
@@ -20,7 +22,7 @@ class BackupService < BaseService
|
||||
|
||||
account.statuses.with_includes.reorder(nil).find_in_batches do |statuses|
|
||||
statuses.each do |status|
|
||||
item = serialize(status, ActivityPub::ActivitySerializer)
|
||||
item = serialize_payload(status, ActivityPub::ActivitySerializer, signer: @account)
|
||||
item.delete(:'@context')
|
||||
|
||||
unless item[:type] == 'Announce' || item[:object][:attachment].blank?
|
||||
|
||||
@@ -5,7 +5,7 @@ class BootstrapTimelineService < BaseService
|
||||
@source_account = source_account
|
||||
|
||||
autofollow_inviter!
|
||||
autofollow_bootstrap_timeline_accounts!
|
||||
autofollow_bootstrap_timeline_accounts! if Setting.enable_bootstrap_timeline_accounts
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -45,7 +45,7 @@ class FetchLinkCardService < BaseService
|
||||
def html
|
||||
return @html if defined?(@html)
|
||||
|
||||
Request.new(:get, @url).perform do |res|
|
||||
Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
|
||||
if res.code == 200 && res.mime_type == 'text/html'
|
||||
@html = res.body_with_limit
|
||||
@html_charset = res.charset
|
||||
|
||||
@@ -93,7 +93,7 @@ class FetchOEmbedService
|
||||
def html
|
||||
return @html if defined?(@html)
|
||||
|
||||
@html = @options[:html] || Request.new(:get, @url).perform do |res|
|
||||
@html = @options[:html] || Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
|
||||
res.code != 200 || res.mime_type != 'text/html' ? nil : res.body_with_limit
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FetchRemoteAccountService < BaseService
|
||||
def call(url, prefetched_body = nil, protocol = :ostatus)
|
||||
if prefetched_body.nil?
|
||||
resource_url, resource_options, protocol = FetchResourceService.new.call(url)
|
||||
else
|
||||
resource_url = url
|
||||
resource_options = { prefetched_body: prefetched_body }
|
||||
end
|
||||
|
||||
case protocol
|
||||
when :activitypub
|
||||
ActivityPub::FetchRemoteAccountService.new.call(resource_url, **resource_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,17 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FetchRemoteStatusService < BaseService
|
||||
def call(url, prefetched_body = nil, protocol = :ostatus)
|
||||
def call(url, prefetched_body = nil)
|
||||
if prefetched_body.nil?
|
||||
resource_url, resource_options, protocol = FetchResourceService.new.call(url)
|
||||
resource_url, resource_options = FetchResourceService.new.call(url)
|
||||
else
|
||||
resource_url = url
|
||||
resource_options = { prefetched_body: prefetched_body }
|
||||
end
|
||||
|
||||
case protocol
|
||||
when :activitypub
|
||||
ActivityPub::FetchRemoteStatusService.new.call(resource_url, **resource_options)
|
||||
end
|
||||
ActivityPub::FetchRemoteStatusService.new.call(resource_url, **resource_options) unless resource_url.nil?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class FetchResourceService < BaseService
|
||||
body = response.body_with_limit
|
||||
json = body_to_json(body)
|
||||
|
||||
[json['id'], { prefetched_body: body, id: true }, :activitypub] if supported_context?(json) && (equals_or_includes_any?(json['type'], ActivityPub::FetchRemoteAccountService::SUPPORTED_TYPES) || expected_type?(json))
|
||||
[json['id'], { prefetched_body: body, id: true }] if supported_context?(json) && (equals_or_includes_any?(json['type'], ActivityPub::FetchRemoteAccountService::SUPPORTED_TYPES) || expected_type?(json))
|
||||
elsif !terminal
|
||||
link_header = response['Link'] && parse_link_header(response)
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ class ResolveURLService < BaseService
|
||||
|
||||
def process_url
|
||||
if equals_or_includes_any?(type, ActivityPub::FetchRemoteAccountService::SUPPORTED_TYPES)
|
||||
FetchRemoteAccountService.new.call(resource_url, body, protocol)
|
||||
ActivityPub::FetchRemoteAccountService.new.call(resource_url, prefetched_body: body)
|
||||
elsif equals_or_includes_any?(type, ActivityPub::Activity::Create::SUPPORTED_TYPES + ActivityPub::Activity::Create::CONVERTED_TYPES)
|
||||
status = FetchRemoteStatusService.new.call(resource_url, body, protocol)
|
||||
status = FetchRemoteStatusService.new.call(resource_url, body)
|
||||
authorize_with @on_behalf_of, status, :show? unless status.nil?
|
||||
status
|
||||
elsif fetched_resource.nil? && @on_behalf_of.present?
|
||||
@@ -45,12 +45,8 @@ class ResolveURLService < BaseService
|
||||
fetched_resource.second[:prefetched_body]
|
||||
end
|
||||
|
||||
def protocol
|
||||
fetched_resource.third
|
||||
end
|
||||
|
||||
def type
|
||||
return json_data['type'] if protocol == :activitypub
|
||||
json_data['type']
|
||||
end
|
||||
|
||||
def json_data
|
||||
|
||||
Reference in New Issue
Block a user