Class: PublicsController

Inherits:
ApplicationController show all
Includes:
Diaspora::Parser
Defined in:
app/controllers/publics_controller.rb

Overview

Copyright © 2010, Diaspora Inc. This file is

  licensed under the Affero General Public License version 3 or later.  See
  the COPYRIGHT file.

Instance Method Summary (collapse)

Methods included from Diaspora::Parser

from_xml

Methods inherited from ApplicationController

#after_sign_in_path_for, #clear_gc_stats, #ensure_http_referer_is_set, #ensure_page, #grammatical_gender, #redirect_unless_admin, #set_git_header, #set_grammatical_gender, #set_header_data, #set_invites, #set_locale, #which_action_and_user

Instance Method Details

- (Object) hcard



17
18
19
20
21
22
23
24
# File 'app/controllers/publics_controller.rb', line 17

def hcard
  @person = Person.where(:guid => params[:guid]).first
  unless @person.nil? || @person.owner.nil?
    render 'publics/hcard'
  else
    render :nothing => true, :status => 404
  end
end

- (Object) host_meta



26
27
28
# File 'app/controllers/publics_controller.rb', line 26

def host_meta
  render 'host_meta', :content_type => 'application/xrd+xml'
end

- (Object) hub



39
40
41
# File 'app/controllers/publics_controller.rb', line 39

def hub
  render :text => params['hub.challenge'], :status => 202, :layout => false
end

- (Object) receive



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/publics_controller.rb', line 43

def receive
  if params[:xml].nil?
    render :nothing => true, :status => 422
    return
  end

  person = Person.where(:guid => params[:guid]).first

  if person.nil? || person.owner_id.nil?
    Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
    render :nothing => true, :status => 404
    return
  end

  @user = person.owner
  Resque.enqueue(Job::ReceiveSalmon, @user.id, CGI::unescape(params[:xml]))

  render :nothing => true, :status => 202
end

- (Object) webfinger



30
31
32
33
34
35
36
37
# File 'app/controllers/publics_controller.rb', line 30

def webfinger
  @person = Person.(params[:q]) if params[:q]
  unless @person.nil?
    render 'webfinger', :content_type => 'application/xrd+xml'
  else
    render :nothing => true, :status => 404
  end
end