|
|
@ -1,6 +1,8 @@
|
|
|
|
# frozen_string_literal: true
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
|
|
class Api::PushController < Api::BaseController
|
|
|
|
class Api::PushController < Api::BaseController
|
|
|
|
|
|
|
|
include SignatureVerification
|
|
|
|
|
|
|
|
|
|
|
|
def update
|
|
|
|
def update
|
|
|
|
response, status = process_push_request
|
|
|
|
response, status = process_push_request
|
|
|
|
render plain: response, status: status
|
|
|
|
render plain: response, status: status
|
|
|
@ -11,7 +13,7 @@ class Api::PushController < Api::BaseController
|
|
|
|
def process_push_request
|
|
|
|
def process_push_request
|
|
|
|
case hub_mode
|
|
|
|
case hub_mode
|
|
|
|
when 'subscribe'
|
|
|
|
when 'subscribe'
|
|
|
|
Pubsubhubbub::SubscribeService.new.call(account_from_topic, hub_callback, hub_secret, hub_lease_seconds)
|
|
|
|
Pubsubhubbub::SubscribeService.new.call(account_from_topic, hub_callback, hub_secret, hub_lease_seconds, verified_domain)
|
|
|
|
when 'unsubscribe'
|
|
|
|
when 'unsubscribe'
|
|
|
|
Pubsubhubbub::UnsubscribeService.new.call(account_from_topic, hub_callback)
|
|
|
|
Pubsubhubbub::UnsubscribeService.new.call(account_from_topic, hub_callback)
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -57,6 +59,10 @@ class Api::PushController < Api::BaseController
|
|
|
|
TagManager.instance.web_domain?(hub_topic_domain)
|
|
|
|
TagManager.instance.web_domain?(hub_topic_domain)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def verified_domain
|
|
|
|
|
|
|
|
return signed_request_account.domain if signed_request_account
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def hub_topic_domain
|
|
|
|
def hub_topic_domain
|
|
|
|
hub_topic_uri.host + (hub_topic_uri.port ? ":#{hub_topic_uri.port}" : '')
|
|
|
|
hub_topic_uri.host + (hub_topic_uri.port ? ":#{hub_topic_uri.port}" : '')
|
|
|
|
end
|
|
|
|
end
|
|
|
|