# frozen_string_literal: true class ActivityPub # Obtiene o actualiza los datos de una instancia. class InstanceFetchJob < ApplicationJob self.priority = 100 def perform(site:, instance:) %w[/api/v2/instance /api/v1/instance].each do |api| uri = SocialInbox.generate_uri(instance.hostname) do |u| u.path = api end response = site.social_inbox.dereferencer.get(uri: uri) next unless response.ok? instance.update(content: response.parsed_response) break end end end end