]> cat aescling's git repositories - mastodon.git/commitdiff
Since GNU Social hubs don't seem to return a hub.lease_seconds param in the subscript...
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 20 Sep 2016 01:24:04 +0000 (03:24 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 20 Sep 2016 01:24:04 +0000 (03:24 +0200)
we'll have to default that value to the GS "minimum" (from their code) which is 24 hours.

app/controllers/api/subscriptions_controller.rb

index aa5cfbe5d94fcf3c5ba317742f54b41f5d0d30d5..c8fa60260ac52c687950af9be4d5a470488315b8 100644 (file)
@@ -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