Remove Community Chatwoot Hub URL/push relay/sync/registration/event/changelog egress. changelog.js becomes a local empty-feed adapter (no axios/fetch/network) exporting the default ChangelogApi; links.js drops the Hub changelog URL. lib/chatwoot_hub.rb removes base_url/push_notification_url/billing_base_url/ instance_config/send_push/send_push_with_response; billing_url reads only an explicit CHATWOOT_BILLING_URL env, HTTPS-only with host and no userinfo, and never falls back to a Hub URL. Enterprise proprietary base_url override is preserved (spec uses singleton_class.instance_methods(false) for edition-safety). privacy_audit uses a narrow per-file/per-rule Enterprise exception (hub-url only) and privacy_audit_test.sh proves forbidden Enterprise runtime lines are still detected; deployment privacy guard unchanged. Approved by independent five-key review deleg_49d6ee2e (passed=true, blocking arrays empty).
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
require 'uri'
|
|
|
|
class ChatwootHub
|
|
def self.installation_identifier
|
|
identifier = InstallationConfig.find_by(name: 'INSTALLATION_IDENTIFIER')&.value
|
|
identifier ||= InstallationConfig.create!(name: 'INSTALLATION_IDENTIFIER', value: SecureRandom.uuid).value
|
|
identifier
|
|
end
|
|
|
|
def self.pricing_plan
|
|
return 'community' unless ChatwootApp.enterprise?
|
|
|
|
InstallationConfig.find_by(name: 'INSTALLATION_PRICING_PLAN')&.value || 'community'
|
|
end
|
|
|
|
def self.pricing_plan_quantity
|
|
return 0 unless ChatwootApp.enterprise?
|
|
|
|
InstallationConfig.find_by(name: 'INSTALLATION_PRICING_PLAN_QUANTITY')&.value || 0
|
|
end
|
|
|
|
def self.billing_url
|
|
configured_url = ENV['CHATWOOT_BILLING_URL'].to_s
|
|
return if configured_url.empty?
|
|
|
|
uri = URI.parse(configured_url)
|
|
return unless uri.scheme == 'https' && uri.host.present? && uri.user.nil? && uri.password.nil?
|
|
|
|
configured_url
|
|
rescue URI::InvalidURIError
|
|
nil
|
|
end
|
|
|
|
def self.support_config
|
|
{
|
|
support_website_token: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_WEBSITE_TOKEN')&.value,
|
|
support_script_url: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_SCRIPT_URL')&.value,
|
|
support_identifier_hash: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_IDENTIFIER_HASH')&.value
|
|
}
|
|
end
|
|
|
|
end
|
|
|
|
ChatwootHub.singleton_class.prepend_mod_with('ChatwootHub')
|