lookup_controller.rb 521 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::LookupController < Api::BaseController
  3. before_action -> { authorize_if_got_token! :read, :'read:accounts' }
  4. before_action :set_account
  5. def show
  6. render json: @account, serializer: REST::AccountSerializer
  7. end
  8. private
  9. def set_account
  10. @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
  11. rescue Addressable::URI::InvalidURIError
  12. raise(ActiveRecord::RecordNotFound)
  13. end
  14. end