about summary refs log tree commit diff
path: root/app/models/remote_follow.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-10-08 00:34:57 +0200
committerGitHub <noreply@github.com>2020-10-08 00:34:57 +0200
commit7d985f2aac639dc5fae528db2dbc4422ca10f276 (patch)
tree6798391ec358c54c324d0019aa95fa86760bd2ae /app/models/remote_follow.rb
parenta37732ef33e44afa960d7e80445369ce6e73d6ad (diff)
Remove dependency on goldfinger gem (#14919)
There are edge cases where requests to certain hosts timeout when
using the vanilla HTTP.rb gem, which the goldfinger gem uses. Now
that we no longer need to support OStatus servers, webfinger logic
is so simple that there is no point encapsulating it in a gem, so
we can just use our own Request class. With that, we benefit from
more robust timeout code and IPv4/IPv6 resolution.

Fix #14091
Diffstat (limited to 'app/models/remote_follow.rb')
-rw-r--r--app/models/remote_follow.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/remote_follow.rb b/app/models/remote_follow.rb
index 30b84f7d5..911c06713 100644
--- a/app/models/remote_follow.rb
+++ b/app/models/remote_follow.rb
@@ -56,7 +56,7 @@ class RemoteFollow
 
     if domain.nil?
       @addressable_template = Addressable::Template.new("#{authorize_interaction_url}?uri={uri}")
-    elsif redirect_url_link.nil? || redirect_url_link.template.nil?
+    elsif redirect_uri_template.nil?
       missing_resource_error
     else
       @addressable_template = Addressable::Template.new(redirect_uri_template)
@@ -64,16 +64,12 @@ class RemoteFollow
   end
 
   def redirect_uri_template
-    redirect_url_link.template
-  end
-
-  def redirect_url_link
-    acct_resource&.link('http://ostatus.org/schema/1.0/subscribe')
+    acct_resource&.link('http://ostatus.org/schema/1.0/subscribe', 'template')
   end
 
   def acct_resource
     @acct_resource ||= webfinger!("acct:#{acct}")
-  rescue Goldfinger::Error, HTTP::ConnectionError
+  rescue Webfinger::Error, HTTP::ConnectionError
     nil
   end