Skip to content

Commit 8a043c2

Browse files
authored
Merge pull request #4933 from brave-intl/fix/pcdn-https
add public name to pcdn and fix https error
2 parents 124bc5b + 105cfa9 commit 8a043c2

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ gem "yt", "~> 0.33"
168168
gem "zeitwerk", "~> 2.6"
169169
gem "zendesk_api", "~> 3.1.0"
170170

171-
# gem "activerecord-nulldb-adapter", git: "https://github.com/taylorthurlow/nulldb", branch: "fix/activerecord72-register-adapter"
172-
173171
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
174172
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
175173

app/jobs/cache/browser_channels/responses_for_prefix.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ def get_site_banner_details(site_banner_lookup)
159159
details[key.underscore] = value
160160
end
161161

162-
public_id = site_banner_lookup.channel.public_identifier
162+
public_id = site_banner_lookup.channel.web3_subdirectory
163163
include_web3 = (site_banner_lookup.channel.crypto_address_for_channels.length > 0) && public_id
164-
details.web3_url = include_web3 ? "#{ENV["CREATORS_HOST"]}/c/#{public_id}" : ""
164+
web3_address = include_web3 ? "#{ENV["CREATORS_HOST"]}/c/#{public_id}" : ""
165165

166166
# ENV host variables serve various purposes, some will begin with https and some wont
167-
details.web3_url.start_with?("https://") ? details.web3_url : "https://#{details.web3_url}"
167+
details.web3_url = (!include_web3 || web3_address.start_with?("https://")) ? web3_address : "https://#{web3_address}"
168168

169169
if site_banner_lookup.derived_site_banner_info["socialLinks"].present?
170170
social_links_pb = nil

app/models/channel.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ def set_public_identifier!
387387
save!
388388
end
389389

390+
def web3_subdirectory
391+
public_name || public_identifier
392+
end
393+
390394
def failed_verification_details
391395
return if verified? || details_type != "SiteChannelDetails"
392396
case verification_details

test/jobs/cache/browser_channels/responses_for_prefix_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def self.test_order
9191
assert service.temp_file.present?
9292
result = Brotli.inflate(File.open(service.temp_file.path, "rb").readlines.join("").slice(4..-1))
9393
result = PublishersPb::ChannelResponseList.decode(result)
94+
9495
assert_equal result.channel_responses[0].wallets[0].gemini_wallet.address, channel.gemini_connection_for_channel.first.recipient_id
9596
assert_equal result.channel_responses[0].channel_identifier, channel.details.channel_identifier
9697
assert_equal result.channel_responses[0].site_banner_details.web3_url, ""

0 commit comments

Comments
 (0)