2016-11-15 15:56:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-26 15:42:38 +01:00
|
|
|
class FetchRemoteAccountService < BaseService
|
2017-08-14 13:08:34 +01:00
|
|
|
def call(url, prefetched_body = nil, protocol = :ostatus)
|
2017-03-22 16:36:34 +00:00
|
|
|
if prefetched_body.nil?
|
2019-07-10 17:59:28 +01:00
|
|
|
resource_url, resource_options, protocol = FetchResourceService.new.call(url)
|
2017-03-22 16:36:34 +00:00
|
|
|
else
|
2017-10-04 00:13:48 +01:00
|
|
|
resource_url = url
|
|
|
|
resource_options = { prefetched_body: prefetched_body }
|
2017-03-22 16:36:34 +00:00
|
|
|
end
|
2016-09-26 15:42:38 +01:00
|
|
|
|
2017-08-14 01:29:36 +01:00
|
|
|
case protocol
|
|
|
|
when :activitypub
|
2017-10-04 00:13:48 +01:00
|
|
|
ActivityPub::FetchRemoteAccountService.new.call(resource_url, **resource_options)
|
2017-08-14 01:29:36 +01:00
|
|
|
end
|
2016-09-26 15:42:38 +01:00
|
|
|
end
|
|
|
|
end
|