2021-02-16 06:28:32 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Api::V1::Accounts::LookupController < Api::BaseController
|
|
|
|
before_action -> { authorize_if_got_token! :read, :'read:accounts' }
|
|
|
|
before_action :set_account
|
|
|
|
|
|
|
|
def show
|
2023-04-25 06:41:34 -07:00
|
|
|
cache_if_unauthenticated!
|
2021-02-16 06:28:32 -08:00
|
|
|
render json: @account, serializer: REST::AccountSerializer
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_account
|
|
|
|
@account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
|
2022-05-01 16:00:08 -07:00
|
|
|
rescue Addressable::URI::InvalidURIError
|
|
|
|
raise(ActiveRecord::RecordNotFound)
|
2021-02-16 06:28:32 -08:00
|
|
|
end
|
|
|
|
end
|