about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-20 03:24:04 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-20 03:24:04 +0200
commit1d2856c2afb6f3e54e15fe34da3c167c29d4f47a (patch)
treeb79b0f4d6fdcfdf8942aaf98e8f79940011dc91e /app
parent246330493b1e57c5423aeaa0990d3978f1739c42 (diff)
Since GNU Social hubs don't seem to return a hub.lease_seconds param in the subscription confirmation request,
we'll have to default that value to the GS "minimum" (from their code) which is 24 hours.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/subscriptions_controller.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb
index aa5cfbe5d..c8fa60260 100644
--- a/app/controllers/api/subscriptions_controller.rb
+++ b/app/controllers/api/subscriptions_controller.rb
@@ -4,8 +4,7 @@ class Api::SubscriptionsController < ApiController
 
   def show
     if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic'])
-      Rails.logger.debug "PuSH confirmation: #{params.inspect}"
-      @account.update(subscription_expires_at: Time.now + (params['hub.lease_seconds'].to_i).seconds)
+      @account.update(subscription_expires_at: Time.now + ((params['hub.lease_seconds'] || 86400).to_i).seconds)
       render plain: HTMLEntities.new.encode(params['hub.challenge']), status: 200
     else
       head 404