0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-05 23:04:22 +08:00
discourse/lib/onebox/domain_checker.rb

18 lines
454 B
Ruby
Vendored

# frozen_string_literal: true
module Onebox
class DomainChecker
def self.is_blocked?(hostname)
normalized_hostname = hostname.to_s.downcase
SiteSetting
.blocked_onebox_domains
&.split("|")
&.any? do |blocked|
normalized_blocked = blocked.downcase
normalized_hostname == normalized_blocked ||
normalized_hostname.end_with?(".#{normalized_blocked}")
end
end
end
end