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