1
0

instance_actors_controller.rb 858 B

123456789101112131415161718192021222324252627282930313233
  1. # frozen_string_literal: true
  2. class InstanceActorsController < ActivityPub::BaseController
  3. vary_by ''
  4. serialization_scope nil
  5. before_action :set_account
  6. skip_before_action :authenticate_user! # From `AccountOwnedConcern`
  7. skip_before_action :require_functional!
  8. skip_before_action :update_user_sign_in
  9. def show
  10. expires_in 10.minutes, public: true
  11. render json: @account, content_type: 'application/activity+json', serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter, fields: restrict_fields_to
  12. end
  13. private
  14. # Skips various `before_action` from `AccountOwnedConcern`
  15. def account_required?
  16. false
  17. end
  18. def set_account
  19. @account = Account.representative
  20. end
  21. def restrict_fields_to
  22. %i(id type preferred_username inbox outbox public_key endpoints url manually_approves_followers)
  23. end
  24. end