Skip to content
Extraits de code Groupes Projets
Valider 64503480 rédigé par Benjamin Neff's avatar Benjamin Neff
Parcourir les fichiers

deliver public posts to relay

parent 902d7fac
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter