Compare to web_domain instead of local_domain when dealing with feeds/API

This commit is contained in:
Thibaut Girka 2017-04-08 22:20:43 +02:00
parent ab6d32f6b7
commit a9a3054302
3 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class Api::PushController < ApiController
params = Rails.application.routes.recognize_path(uri.path)
domain = uri.host + (uri.port ? ":#{uri.port}" : '')
return unless TagManager.instance.local_domain?(domain) && params[:controller] == 'accounts' && params[:action] == 'show' && params[:format] == 'atom'
return unless TagManager.instance.web_domain?(domain) && params[:controller] == 'accounts' && params[:action] == 'show' && params[:format] == 'atom'
Account.find_local(params[:username])
end

View File

@ -56,6 +56,10 @@ class TagManager
id.start_with?("tag:#{Rails.configuration.x.local_domain}")
end
def web_domain?(domain)
domain.nil? || domain.gsub(/[\/]/, '').casecmp(Rails.configuration.x.web_domain).zero?
end
def local_domain?(domain)
domain.nil? || domain.gsub(/[\/]/, '').casecmp(Rails.configuration.x.local_domain).zero?
end

View File

@ -7,6 +7,7 @@ https = ENV['LOCAL_HTTPS'] == 'true'
Rails.application.configure do
config.x.local_domain = host
config.x.web_domain = web_host
config.x.use_https = https
config.x.use_s3 = ENV['S3_ENABLED'] == 'true'