summaryrefslogtreecommitdiff
path: root/users/app/controllers/webfinger_controller.rb
blob: f28dd3e2b54551c23c3f998c55fc97062f83d401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class WebfingerController < ApplicationController

  respond_to :xml, :json
  layout false

  def host_meta
    @host_meta = Webfinger::HostMetaPresenter.new(request)
    respond_with @host_meta
  end

  def search
    username = params[:q].split('@')[0].to_s.downcase
    user = User.find_by_login(username)
    raise RECORD_NOT_FOUND, 'User not found' unless user.present?
    @subject = Webfinger::UserPresenter.new(user, request)
    respond_with @subject
  end

end