2017-04-19 11:52:37 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module AccountControllerConcern
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2022-10-20 12:35:29 +00:00
|
|
|
include WebAppControllerConcern
|
2019-07-08 10:03:45 +00:00
|
|
|
include AccountOwnedConcern
|
|
|
|
|
2017-04-19 11:52:37 +00:00
|
|
|
FOLLOW_PER_PAGE = 12
|
|
|
|
|
|
|
|
included do
|
2018-07-28 17:25:33 +00:00
|
|
|
before_action :set_instance_presenter
|
2023-03-25 23:40:01 +00:00
|
|
|
|
|
|
|
after_action :set_link_headers, if: -> { request.format.nil? || request.format == :html }
|
2017-04-19 11:52:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-07-28 17:25:33 +00:00
|
|
|
def set_instance_presenter
|
|
|
|
@instance_presenter = InstancePresenter.new
|
|
|
|
end
|
|
|
|
|
2017-04-19 11:52:37 +00:00
|
|
|
def set_link_headers
|
|
|
|
response.headers['Link'] = LinkHeader.new(
|
|
|
|
[
|
|
|
|
webfinger_account_link,
|
2017-08-12 22:45:04 +00:00
|
|
|
actor_url_link,
|
2017-04-19 11:52:37 +00:00
|
|
|
]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def webfinger_account_link
|
|
|
|
[
|
|
|
|
webfinger_account_url,
|
2019-07-08 10:03:45 +00:00
|
|
|
[%w(rel lrdd), %w(type application/jrd+json)],
|
2017-04-19 11:52:37 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2017-08-12 22:45:04 +00:00
|
|
|
def actor_url_link
|
|
|
|
[
|
|
|
|
ActivityPub::TagManager.instance.uri_for(@account),
|
|
|
|
[%w(rel alternate), %w(type application/activity+json)],
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2017-04-19 11:52:37 +00:00
|
|
|
def webfinger_account_url
|
|
|
|
webfinger_url(resource: @account.to_webfinger_s)
|
|
|
|
end
|
|
|
|
end
|