Instead of refusing to create accounts, domain blocks auto-suspend new accounts from that domain

This commit is contained in:
Eugen Rochko 2017-01-20 20:14:02 +01:00
parent 05abd977c1
commit 9bd3b11cfb
4 changed files with 6 additions and 3 deletions

View file

@ -4,8 +4,11 @@ import appReducer from '../reducers';
import loadingBarMiddleware from '../middleware/loading_bar'; import loadingBarMiddleware from '../middleware/loading_bar';
import errorsMiddleware from '../middleware/errors'; import errorsMiddleware from '../middleware/errors';
import soundsMiddleware from 'redux-sounds'; import soundsMiddleware from 'redux-sounds';
import Howler from 'howler';
import Immutable from 'immutable'; import Immutable from 'immutable';
Howler.mobileAutoEnable = false;
const soundsData = { const soundsData = {
boop: '/sounds/boop.mp3' boop: '/sounds/boop.mp3'
}; };

View file

@ -14,7 +14,6 @@ class FollowRemoteAccountService < BaseService
username, domain = uri.split('@') username, domain = uri.split('@')
return Account.find_local(username) if TagManager.instance.local_domain?(domain) return Account.find_local(username) if TagManager.instance.local_domain?(domain)
return nil if DomainBlock.blocked?(domain)
account = Account.find_remote(username, domain) account = Account.find_remote(username, domain)
return account unless account.nil? return account unless account.nil?
@ -41,6 +40,7 @@ class FollowRemoteAccountService < BaseService
account.url = data.link('http://webfinger.net/rel/profile-page').href account.url = data.link('http://webfinger.net/rel/profile-page').href
account.public_key = magic_key_to_pem(data.link('magic-public-key').href) account.public_key = magic_key_to_pem(data.link('magic-public-key').href)
account.private_key = nil account.private_key = nil
account.suspended = true if DomainBlock.blocked?(domain)
xml = get_feed(account.remote_url) xml = get_feed(account.remote_url)
hubs = get_hubs(xml) hubs = get_hubs(xml)

View file

@ -61,7 +61,7 @@ class ProcessFeedService < BaseService
status.save! status.save!
NotifyService.new.call(status.reblog.account, status) if status.reblog? && status.reblog.account.local? NotifyService.new.call(status.reblog.account, status) if status.reblog? && status.reblog.account.local?
LinkCrawlWorker.perform_async(status.reblog? ? status.reblog_of_id : status.id) # LinkCrawlWorker.perform_async(status.reblog? ? status.reblog_of_id : status.id)
Rails.logger.debug "Queuing remote status #{status.id} (#{id}) for distribution" Rails.logger.debug "Queuing remote status #{status.id} (#{id}) for distribution"
DistributionWorker.perform_async(status.id) DistributionWorker.perform_async(status.id)
status status

View file

@ -10,7 +10,7 @@ class UpdateRemoteProfileService < BaseService
unless author_xml.nil? unless author_xml.nil?
account.display_name = author_xml.at_xpath('./poco:displayName', poco: TagManager::POCO_XMLNS).content unless author_xml.at_xpath('./poco:displayName', poco: TagManager::POCO_XMLNS).nil? account.display_name = author_xml.at_xpath('./poco:displayName', poco: TagManager::POCO_XMLNS).content unless author_xml.at_xpath('./poco:displayName', poco: TagManager::POCO_XMLNS).nil?
account.note = author_xml.at_xpath('./poco:note', poco: TagManager::POCO_XMLNS).content unless author_xml.at_xpath('./poco:note', poco: TagManager::POCO_XMLNS).nil? account.note = author_xml.at_xpath('./poco:note', poco: TagManager::POCO_XMLNS).content unless author_xml.at_xpath('./poco:note', poco: TagManager::POCO_XMLNS).nil?
account.avatar_remote_url = author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS)['href'] unless author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS).nil? || author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS)['href'].blank? account.avatar_remote_url = author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS)['href'] unless author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS).nil? || author_xml.at_xpath('./xmlns:link[@rel="avatar"]', xmlns: TagManager::XMLNS)['href'].blank? || account.suspended?
end end
old_hub_url = account.hub_url old_hub_url = account.hub_url