self_destruct_helper.rb 436 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. module SelfDestructHelper
  3. VERIFY_PURPOSE = 'self-destruct'
  4. def self.self_destruct?
  5. value = Rails.configuration.x.mastodon.self_destruct_value
  6. value.present? && Rails.application.message_verifier(VERIFY_PURPOSE).verify(value) == ENV['LOCAL_DOMAIN']
  7. rescue ActiveSupport::MessageVerifier::InvalidSignature
  8. false
  9. end
  10. def self_destruct?
  11. SelfDestructHelper.self_destruct?
  12. end
  13. end