mirror of
https://github.com/mastodon/mastodon.git
synced 2026-10-14 01:19:36 -05:00
27 lines
738 B
Ruby
27 lines
738 B
Ruby
# frozen_string_literal: true
|
|
|
|
module AuthorizedFetchHelper
|
|
def authorized_fetch_mode
|
|
case ENV.fetch('AUTHORIZED_FETCH') { Setting.authorized_fetch }
|
|
when true, 'true', 'all'
|
|
'all'
|
|
when false, 'false', 'none'
|
|
'none'
|
|
else
|
|
'actors'
|
|
end
|
|
end
|
|
|
|
def authorized_fetch_mode?
|
|
authorized_fetch_mode == 'all' || Rails.configuration.x.mastodon.limited_federation_mode
|
|
end
|
|
|
|
def actors_require_signature?
|
|
Mastodon::Feature.bloom_filters_enabled? || %w(actors all).include?(authorized_fetch_mode) || Rails.configuration.x.mastodon.limited_federation_mode
|
|
end
|
|
|
|
def authorized_fetch_overridden?
|
|
ENV.key?('AUTHORIZED_FETCH') || Rails.configuration.x.mastodon.limited_federation_mode
|
|
end
|
|
end
|