From a94c152fd30cb91c1f4bd9c1e000ea68d0385bfa Mon Sep 17 00:00:00 2001 From: Immae Date: Mon, 22 May 2017 15:40:04 +0200 Subject: Allow alternate domains for mastodon handlers (#3187) --- app/controllers/well_known/webfinger_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/well_known/webfinger_controller.rb b/app/controllers/well_known/webfinger_controller.rb index 4a521d102..84f3015e8 100644 --- a/app/controllers/well_known/webfinger_controller.rb +++ b/app/controllers/well_known/webfinger_controller.rb @@ -23,7 +23,14 @@ module WellKnown private def username_from_resource - WebfingerResource.new(resource_param).username + resource_user = resource_param + + username, domain = resource_user.split('@') + if Rails.configuration.x.alternate_domains.include?(domain) + resource_user = "#{username}@#{Rails.configuration.x.local_domain}" + end + + WebfingerResource.new(resource_user).username end def pem_to_magic_key(public_key) -- cgit