mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 06:51:41 +00:00
fix: guardar los datos de la instancia
This commit is contained in:
parent
34ead9ea4a
commit
342521c897
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub
|
class ActivityPub
|
||||||
# Obtiene o actualiza los datos de una instancia.
|
# Obtiene o actualiza los datos de una instancia. Usamos un cliente
|
||||||
|
# de ActivityPub porque la instancia podría estar en federación
|
||||||
|
# limitada.
|
||||||
class InstanceFetchJob < ApplicationJob
|
class InstanceFetchJob < ApplicationJob
|
||||||
self.priority = 100
|
self.priority = 100
|
||||||
|
|
||||||
|
@ -14,8 +16,10 @@ class ActivityPub
|
||||||
response = site.social_inbox.dereferencer.get(uri: uri)
|
response = site.social_inbox.dereferencer.get(uri: uri)
|
||||||
|
|
||||||
next unless response.ok?
|
next unless response.ok?
|
||||||
|
# @todo Validate schema
|
||||||
|
next unless response.parsed_response.is_a?(DistributedPress::V1::Social::ReferencedObject)
|
||||||
|
|
||||||
instance.update(content: response.parsed_response)
|
instance.update(content: response.parsed_response.object)
|
||||||
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue