mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 15:54:05 +08:00
21 lines
464 B
Ruby
21 lines
464 B
Ruby
module Jobs
|
|
|
|
class ConfirmSnsSubscription < Jobs::Base
|
|
sidekiq_options retry: false
|
|
|
|
def execute(args)
|
|
return unless raw = args[:raw].presence
|
|
return unless json = args[:json].presence
|
|
return unless subscribe_url = json["SubscribeURL"].presence
|
|
|
|
require "aws-sdk-sns"
|
|
return unless Aws::SNS::MessageVerifier.new.authentic?(raw)
|
|
|
|
# confirm subscription by visiting the URL
|
|
open(subscribe_url)
|
|
end
|
|
|
|
end
|
|
|
|
end
|