Class: Fedipub::Server::WebFingerController

Inherits:
Fedipub::ServerController show all
Defined in:
app/controllers/fedipub/server/web_finger_controller.rb

Instance Method Summary collapse

Methods inherited from Fedipub::ServerController

require_signature?

Instance Method Details

#find ⇒ Object

Raises:

  • (ActiveRecord::RecordNotFound)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/fedipub/server/web_finger_controller.rb', line 6

def find
  skip_authorization

  case resource = params.require(:resource)
  when %r{^https?://#{Fedipub::Utils::Host.localhost}/?$}
    @actor = Fedipub::Actor.application_actor
  when %r{^https?://.+}
    @actor = Fedipub::Actor.find_by_federation_url!(resource) # rubocop:disable Rails/DynamicFindBy
  when /^acct:.+/
    @actor = Fedipub::Actor.find_local_by_username(username)
    raise Fedipub::Actor::TombstonedError if @actor&.tombstoned?
  end
  raise ActiveRecord::RecordNotFound if @actor.nil?

  render formats: [:jrd]
end

#host_meta ⇒ Object



23
24
25
26
27
# File 'app/controllers/fedipub/server/web_finger_controller.rb', line 23

def host_meta
  skip_authorization

  render formats: [:xrd]
end