Newer
Older
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
skip_before_action :set_header_data
skip_before_action :set_grammatical_gender
before_action :check_for_xml, :only => [:receive, :receive_public]
before_action :authenticate_user!, :only => [:index]
Raphael Sofaer
a validé
respond_to :html
respond_to :xml, :only => :post
caches_page :host_meta, :if => Proc.new{ Rails.env == 'production'}
@person = Person.find_by_guid_and_closed_account(params[:guid], false)
Ilya Zhitomirskiy
a validé
if @person.present? && @person.local?
danielvincent
a validé
render 'publics/hcard'
else
render :nothing => true, :status => 404
render 'host_meta', :content_type => 'application/xrd+xml'
@person = Person.local_by_account_identifier(params[:q]) if params[:q]
Ilya Zhitomirskiy
a validé
if @person.nil? || @person.closed_account?
Ilya Zhitomirskiy
a validé
render :nothing => true, :status => 404
return
end
logger.info "webfinger profile request for: #{@person.id}"
render 'webfinger', :content_type => 'application/xrd+xml'
render :text => params['hub.challenge'], :status => 202, :layout => false
def receive_public
logger.info "received a public message"
Workers::ReceiveUnencryptedSalmon.perform_async(CGI::unescape(params[:xml]))
render :nothing => true, :status => :ok
end
person = Person.find_by_guid(params[:guid])
logger.error "Received post for nonexistent person #{params[:guid]}"
Raphael
a validé
end
logger.info "received a private message for user: #{@user.id}"
Workers::ReceiveEncryptedSalmon.perform_async(@user.id, CGI::unescape(params[:xml]))
private
def check_for_xml
if params[:xml].nil?
render :nothing => true, :status => 422
return
end
end