Merge branch 'master' into feature-limited-visibility-bearcaps
This commit is contained in:
commit
98a2603dc1
855 changed files with 32564 additions and 10102 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
class ActivityPub::DeliveryWorker
|
||||
include Sidekiq::Worker
|
||||
include RoutingHelper
|
||||
include JsonLdHelper
|
||||
|
||||
STOPLIGHT_FAILURE_THRESHOLD = 10
|
||||
|
@ -38,9 +39,18 @@ class ActivityPub::DeliveryWorker
|
|||
Request.new(:post, @inbox_url, body: @json, http_client: http_client).tap do |request|
|
||||
request.on_behalf_of(@source_account, :uri, sign_with: @options[:sign_with])
|
||||
request.add_headers(HEADERS)
|
||||
request.add_headers({ 'Collection-Synchronization' => synchronization_header }) if ENV['DISABLE_FOLLOWERS_SYNCHRONIZATION'] != 'true' && @options[:synchronize_followers]
|
||||
end
|
||||
end
|
||||
|
||||
def synchronization_header
|
||||
"collectionId=\"#{account_followers_url(@source_account)}\", digest=\"#{@source_account.remote_followers_hash(inbox_url_prefix)}\", url=\"#{account_followers_synchronization_url(@source_account)}\""
|
||||
end
|
||||
|
||||
def inbox_url_prefix
|
||||
@inbox_url[/http(s?):\/\/[^\/]+\//]
|
||||
end
|
||||
|
||||
def perform_request
|
||||
light = Stoplight(@inbox_url) do
|
||||
request_pool.with(@host) do |http_client|
|
||||
|
|
|
@ -45,7 +45,7 @@ class ActivityPub::DistributionWorker
|
|||
|
||||
def deliver_to_inboxes!
|
||||
ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url|
|
||||
[payload, @account.id, inbox_url]
|
||||
[payload, @account.id, inbox_url, { synchronize_followers: !@status.distributable? }]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
14
app/workers/activitypub/followers_synchronization_worker.rb
Normal file
14
app/workers/activitypub/followers_synchronization_worker.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::FollowersSynchronizationWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'push', lock: :until_executed
|
||||
|
||||
def perform(account_id, url)
|
||||
@account = Account.find_by(id: account_id)
|
||||
return true if @account.nil?
|
||||
|
||||
ActivityPub::SynchronizeFollowersService.new.call(@account, url)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue