Class: PshbController

Inherits:
ApplicationController
  • Object
show all
Includes:
SocialStream::Ostatus::Controllers::DebugRequests
Defined in:
app/controllers/pshb_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  case params['hub.mode']
  #TODO check PuSH specification about subscribe or async
  when 'subscribe', 'async'
    render :text => params['hub.challenge'], :status => 200
    # TODO: confirm that params['hub.topic'] is a real 
    # requested subscription by someone in this node
    return
  when 'unsubscribe'
    render :text => params['hub.challenge'], :status => 200
    # TODO: confirm that params['hub.topic'] is a real 
    # requested unsubscription by someone in this node
    # and delete permissions/remote actor if necessary
    return
  end  

  SocialStream::ActivityStreams.from_pshb_callback(request.body.read)

  render text: "Success!"
end