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