deliver public posts to relay
This commit is contained in:
parent
902d7faca4
commit
645034800d
3 changed files with 11 additions and 5 deletions
|
|
@ -187,7 +187,7 @@ defaults:
|
|||
relay:
|
||||
outbound:
|
||||
send: false
|
||||
handle: 'relay@relay.iliketoast.net'
|
||||
url: 'https://relay.iliketoast.net/receive/public'
|
||||
inbound:
|
||||
subscribe: false
|
||||
scope: tags
|
||||
|
|
|
|||
|
|
@ -645,8 +645,8 @@ configuration: ## Section
|
|||
outbound: ## Section
|
||||
## Enable this setting to send out public posts from this pod to a relay
|
||||
#send: false
|
||||
## Change default remote relay handle used for sending out here
|
||||
#handle: 'relay@relay.iliketoast.net'
|
||||
## Change default remote relay url used for sending out here
|
||||
#url: 'https://relay.iliketoast.net/receive/public'
|
||||
|
||||
inbound: ## Section
|
||||
## Enable this to receive public posts from relays
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ module Diaspora
|
|||
class Public < Dispatcher
|
||||
def deliver_to_services
|
||||
deliver_to_hub if object.instance_of?(StatusMessage)
|
||||
# TODO: pubsubhubbub, relay
|
||||
super
|
||||
end
|
||||
|
||||
def deliver_to_remote(people)
|
||||
targets = target_urls(people) + additional_target_urls
|
||||
|
||||
entity = Entities.build(object)
|
||||
Workers::SendPublic.perform_async(sender.id, entity.to_s, target_urls(people), salmon_xml(entity))
|
||||
Workers::SendPublic.perform_async(sender.id, entity.to_s, targets, salmon_xml(entity))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -19,6 +20,11 @@ module Diaspora
|
|||
Pod.where(id: people.map(&:pod_id).uniq).map {|pod| pod.url_to("/receive/public") }
|
||||
end
|
||||
|
||||
def additional_target_urls
|
||||
return [] unless AppConfig.relay.outbound.send? && object.instance_of?(StatusMessage)
|
||||
[AppConfig.relay.outbound.url]
|
||||
end
|
||||
|
||||
def salmon_xml(entity)
|
||||
DiasporaFederation::Salmon::Slap.generate_xml(
|
||||
sender.diaspora_handle,
|
||||
|
|
|
|||
Loading…
Reference in a new issue