parent
28b15ab268
commit
0048a8368e
6 changed files with 74 additions and 1 deletions
|
@ -13,7 +13,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
|
||||
# Should be called with confirmed valid JSON
|
||||
# and WebFinger-resolved username and domain
|
||||
def call(username, domain, json, options = {})
|
||||
def call(username, domain, json, options = {}) # rubocop:disable Metrics/PerceivedComplexity
|
||||
return if json['inbox'].blank? || unsupported_uri_scheme?(json['id']) || domain_not_allowed?(domain)
|
||||
|
||||
@options = options
|
||||
|
@ -37,6 +37,8 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
@suspension_changed = false
|
||||
|
||||
if @account.nil?
|
||||
return nil if blocking_new_account?(@domain)
|
||||
|
||||
with_redis do |redis|
|
||||
return nil if redis.pfcount("unique_subdomains_for:#{PublicSuffix.domain(@domain, ignore_private: true)}") >= SUBDOMAINS_RATELIMIT
|
||||
|
||||
|
@ -130,6 +132,16 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
@account.memorial = @json['memorial'] || false
|
||||
end
|
||||
|
||||
def blocking_new_account?(domain)
|
||||
return false if permit_new_account_domains.blank?
|
||||
|
||||
permit_new_account_domains.exclude?(domain)
|
||||
end
|
||||
|
||||
def permit_new_account_domains
|
||||
(Setting.permit_new_account_domains || []).compact_blank
|
||||
end
|
||||
|
||||
def valid_account?
|
||||
display_name = @json['name'] || ''
|
||||
note = @json['summary'] || ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue