Class: WebfingerController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
ActionController::Redirecting
Defined in:
app/controllers/webfinger_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/webfinger_controller.rb', line 5

def index
  actor = Actor.find_by_webfinger!(params[:q])

  finger = Proudhon::Finger.new(
    :subject => actor.webfinger_uri,
    :alias   => [polymorphic_url(actor.subject)],
    :links   => {
      avatar: root_url + actor..url(:original),
      profile: polymorphic_url([actor.subject, :profile]),
      updates_from: polymorphic_url([actor.subject, :activities], :format => :atom),
      salmon: salmon_url(actor.slug),
      replies: salmon_url(actor.slug),
      mention: salmon_url(actor.slug),
      magic_key: actor.magic_public_key
    })

  self.response_body = finger.to_xml
  self.content_type  = Mime::XML
end