Skip to content

Commit 3ae3f94

Browse files
authored
Merge pull request #4856 from brave-intl/feat/brave-domains
Feat/brave domains
2 parents f9aeaac + 378e3d0 commit 3ae3f94

File tree

7 files changed

+1410
-1843
lines changed

7 files changed

+1410
-1843
lines changed

app/controllers/site_channels_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def create
5353
@current_channel = Channel.new(publisher: current_publisher)
5454
@current_channel.details = SiteChannelDetails.new(channel_update_unverified_params.except(:ads_enabled))
5555
@current_channel.details.ads_enabled_at = ActiveModel::Type::Boolean.new.cast(channel_update_unverified_params[:ads_enabled]) ? Time.now : nil
56+
5657
SiteChannelDomainSetter.new(channel_details: @current_channel.details).perform
5758

5859
if @current_channel.save

app/services/site_channel_domain_setter.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def normalize_domain
3737
# Throw a Addressable::URI:InvalidURIError if it's an invalid URI
3838
Addressable::URI.parse("http://#{channel_details.brave_publisher_id}")
3939

40-
unless DomainName(channel_details.brave_publisher_id).canonical_tld?
40+
acceptable_tld = ["brave"].include?(PublicSuffix.parse(channel_details.brave_publisher_id).tld) ||
41+
DomainName(channel_details.brave_publisher_id).canonical_tld?
42+
43+
unless acceptable_tld
4144
raise DomainExclusionError.new("Non-canonical TLD for #{channel_details.brave_publisher_id}")
4245
end
4346

0 commit comments

Comments
 (0)