diff options
Diffstat (limited to 'app/api/mastodon/ostatus.rb')
-rw-r--r-- | app/api/mastodon/ostatus.rb | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/app/api/mastodon/ostatus.rb b/app/api/mastodon/ostatus.rb deleted file mode 100644 index 4676bc429..000000000 --- a/app/api/mastodon/ostatus.rb +++ /dev/null @@ -1,62 +0,0 @@ -module Mastodon - class Ostatus < Grape::API - format :txt - - before do - @account = Account.find(params[:id]) - end - - resource :subscriptions do - helpers do - include ApplicationHelper - end - - desc 'Receive updates from an account' - - params do - requires :id, type: String, desc: 'Account ID' - end - - post ':id' do - body = request.body.read - - if @account.subscription(subscription_url(@account)).verify(body, env['HTTP_X_HUB_SIGNATURE']) - ProcessFeedService.new.(body, @account) - status 201 - else - status 202 - end - end - - desc 'Confirm PuSH subscription to an account' - - params do - requires :id, type: String, desc: 'Account ID' - requires 'hub.topic', type: String, desc: 'Topic URL' - requires 'hub.verify_token', type: String, desc: 'Verification token' - requires 'hub.challenge', type: String, desc: 'Hub challenge' - end - - get ':id' do - if @account.subscription(subscription_url(@account)).valid?(params['hub.topic'], params['hub.verify_token']) - params['hub.challenge'] - else - error! :not_found, 404 - end - end - end - - resource :salmon do - desc 'Receive Salmon updates targeted to account' - - params do - requires :id, type: String, desc: 'Account ID' - end - - post ':id' do - ProcessInteractionService.new.(request.body.read, @account) - status 201 - end - end - end -end |