instances_controller.rb 535 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class Api::V1::InstancesController < Api::BaseController
  3. skip_before_action :require_authenticated_user!, unless: :limited_federation_mode?
  4. skip_around_action :set_locale
  5. vary_by ''
  6. # Override `current_user` to avoid reading session cookies unless in whitelist mode
  7. def current_user
  8. super if limited_federation_mode?
  9. end
  10. def show
  11. cache_even_if_authenticated!
  12. render_with_cache json: InstancePresenter.new, serializer: REST::V1::InstanceSerializer, root: 'instance'
  13. end
  14. end