闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
540 B

  1. # frozen_string_literal: true
  2. module WebfingerHelper
  3. def webfinger!(uri)
  4. hidden_service_uri = /\.(onion|i2p)(:\d+)?$/.match(uri)
  5. raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if !Rails.configuration.x.access_to_hidden_service && hidden_service_uri
  6. opts = {
  7. ssl: !hidden_service_uri,
  8. headers: {
  9. 'User-Agent': Mastodon::Version.user_agent,
  10. },
  11. }
  12. Goldfinger::Client.new(uri, opts.merge(Rails.configuration.x.http_client_proxy)).finger
  13. end
  14. end