mastodon/app/controllers/api/v2/instances_controller.rb
Claire 290f6d428d Change /api/v2/instance to be enabled without authentication when limited federation mode is enabled
Additionally, add `configuration.closed_federation` to indicate whether the
server has switched to limited federation.

Also sets `usage.users.active_month` to `0` in limited federation mode.
2025-04-29 15:59:28 +02:00

19 lines
505 B
Ruby

# frozen_string_literal: true
class Api::V2::InstancesController < Api::BaseController
skip_before_action :require_authenticated_user!
skip_around_action :set_locale
vary_by ''
# Override `current_user` to avoid reading session cookies unless in limited federation mode
def current_user
super if limited_federation_mode?
end
def show
cache_even_if_authenticated!
render_with_cache json: InstancePresenter.new, serializer: REST::InstanceSerializer, root: 'instance'
end
end