2023-10-23 17:46:21 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SelfDestructHelper
|
2024-11-18 10:57:16 +01:00
|
|
|
VERIFY_PURPOSE = 'self-destruct'
|
|
|
|
|
2023-10-23 17:46:21 +02:00
|
|
|
def self.self_destruct?
|
2024-11-18 10:57:16 +01:00
|
|
|
value = Rails.configuration.x.mastodon.self_destruct_value
|
|
|
|
value.present? && Rails.application.message_verifier(VERIFY_PURPOSE).verify(value) == ENV['LOCAL_DOMAIN']
|
2023-10-23 17:46:21 +02:00
|
|
|
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def self_destruct?
|
|
|
|
SelfDestructHelper.self_destruct?
|
|
|
|
end
|
|
|
|
end
|