diff options
author | Immae <immae@users.noreply.github.com> | 2017-05-22 15:40:04 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-22 15:40:04 +0200 |
commit | a94c152fd30cb91c1f4bd9c1e000ea68d0385bfa (patch) | |
tree | e97eeb4a3bd504a675fbee0557eb91ab857359ce /app | |
parent | 9d04de1c8d3efb745cfcae3519cee016751b86ec (diff) |
Allow alternate domains for mastodon handlers (#3187)
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/well_known/webfinger_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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) |