diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-14 23:01:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 23:01:20 +0200 |
commit | cd9b2ab2f70b6c1da5d0abeaa88eecdfc1b41f78 (patch) | |
tree | 318a07018a0d2467cfd888c405925b4fe8f39b38 /app/workers | |
parent | de397f3bc1f1c7e632d0db0754711beb6ce04664 (diff) |
Fix #2672 - Connect signed PuSH subscription requests to instance domain (#4205)
* Fix #2672 - Connect signed PuSH subscription requests to instance domain Resolves #2739 * Fix return of locate_subscription * Fix tests
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/pubsubhubbub/distribution_worker.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb index b41cec90d..7592354cc 100644 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ b/app/workers/pubsubhubbub/distribution_worker.rb @@ -35,16 +35,16 @@ class Pubsubhubbub::DistributionWorker @payload = AtomSerializer.render(AtomSerializer.new.feed(@account, stream_entries)) @domains = @account.followers.domains - Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.reject { |s| !allowed_to_receive?(s.callback_url) }) do |subscription| + Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.reject { |s| !allowed_to_receive?(s.callback_url, s.domain) }) do |subscription| [subscription.id, @payload] end end def active_subscriptions - Subscription.where(account: @account).active.select('id, callback_url') + Subscription.where(account: @account).active.select('id, callback_url, domain') end - def allowed_to_receive?(callback_url) - @domains.include?(Addressable::URI.parse(callback_url).host) + def allowed_to_receive?(callback_url, domain) + (!domain.nil? && @domains.include?(domain)) || @domains.include?(Addressable::URI.parse(callback_url).host) end end |