Skip to content

Commit c2bd768

Browse files
authored
fix: onboarding flow in Brave (#1011)
This replaces bafkqaaa with bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss to ensure gateway response in go-ipfs 0.9 does not error. Fixes brave/brave-browser#16671
1 parent f80e719 commit c2bd768

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

add-on/src/lib/ipfs-client/brave.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ exports.destroy = async function (browser) {
4040
// ipfs:// URI that will be used for triggering the "Enable IPFS" dropbar in Brave
4141
// Here we use inlined empty byte array, which resolves instantly and does not
4242
// introduce any delay in UI.
43-
const braveIpfsUriTrigger = 'ipfs://bafkqaaa/'
44-
const braveGatewayUrlTrigger = 'https://bafkqaaa.ipfs.dweb.link/'
43+
const braveIpfsUriTrigger = 'ipfs://bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss/'
44+
const braveGatewayUrlTrigger = 'https://bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss.ipfs.dweb.link/'
4545

4646
// Settings screen in Brave where user can manage IPFS support
4747
const braveSettingsPage = 'brave://settings/extensions'
@@ -245,10 +245,10 @@ async function activationUiCleanup (browser) {
245245
try {
246246
// after useBraveEndpoint we can start polling for gateway to become online
247247
const { customGatewayUrl: braveGwUrl } = await browser.storage.local.get('customGatewayUrl')
248-
// wait 1m for gateway to be online (bafkqaaa)
248+
// wait 1m for gateway to be online (bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss)
249249
await waitFor(async () => {
250250
try {
251-
return await fetch(`${braveGwUrl}/ipfs/bafkqaaa`).then(response => response.ok)
251+
return await fetch(`${braveGwUrl}/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss`).then(response => response.ok)
252252
} catch (_) {
253253
return false
254254
}

test/functional/lib/ipfs-request-workarounds.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ describe('modifyRequest processing', function () {
303303
it('should force native URI in address bar via tabs.update API', async function () {
304304
const httpDNSLinkUrl = 'https://example.com/ipns/docs.ipfs.io/some/path?query=val'
305305
const nativeDNSLinkUri = 'ipns://docs.ipfs.io/some/path?query=val'
306-
spoofDnsTxtRecord('docs.ipfs.io', dnslinkResolver, '/ipfs/bafkqaaa')
306+
spoofDnsTxtRecord('docs.ipfs.io', dnslinkResolver, '/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss')
307307
state.ipfsNodeType = braveNodeType
308308
// ensure clean modifyRequest
309309
runtime = Object.assign({}, await createRuntimeChecks(browser)) // make it mutable for tests
@@ -330,7 +330,7 @@ describe('modifyRequest processing', function () {
330330
const request = {
331331
method: 'GET',
332332
type: 'image',
333-
url: 'https://ipfs.io/ipfs/bafkqaaa',
333+
url: 'https://ipfs.io/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss',
334334
initiator: 'https://some-website.example.com' // Brave (built on Chromium)
335335
}
336336
expect(modifyRequest.onBeforeRequest(request))
@@ -339,7 +339,7 @@ describe('modifyRequest processing', function () {
339339
it('should be left untouched if subresource (would be blocked by Brave Shields)', function () {
340340
runtime.isFirefox = false
341341
runtime.brave = { thisIsFakeBraveRuntime: true }
342-
const cid = 'bafkqaaa'
342+
const cid = 'bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss'
343343
const request = {
344344
method: 'GET',
345345
type: 'main_frame',

yarn.lock

+4-9
Original file line numberDiff line numberDiff line change
@@ -3016,15 +3016,10 @@ camelcase@^6.0.0:
30163016
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.1.0.tgz#27dc176173725fb0adf8a48b647f4d7871944d78"
30173017
integrity sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ==
30183018

3019-
caniuse-lite@^1.0.30001135:
3020-
version "1.0.30001151"
3021-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001151.tgz#1ddfde5e6fff02aad7940b4edb7d3ac76b0cb00b"
3022-
integrity sha512-Zh3sHqskX6mHNrqUerh+fkf0N72cMxrmflzje/JyVImfpknscMnkeJrlFGJcqTmaa0iszdYptGpWMJCRQDkBVw==
3023-
3024-
caniuse-lite@^1.0.30001181:
3025-
version "1.0.30001198"
3026-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001198.tgz#ed2d9b5f060322ba2efa42afdc56dee3255473f4"
3027-
integrity sha512-r5GGgESqOPZzwvdLVER374FpQu2WluCF1Z2DSiFJ89KSmGjT0LVKjgv4NcAqHmGWF9ihNpqRI9KXO9Ex4sKsgA==
3019+
caniuse-lite@^1.0.30001135, caniuse-lite@^1.0.30001181:
3020+
version "1.0.30001238"
3021+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001238.tgz"
3022+
integrity sha512-bZGam2MxEt7YNsa2VwshqWQMwrYs5tR5WZQRYSuFxsBQunWjBuXhN4cS9nV5FFb1Z9y+DoQcQ0COyQbv6A+CKw==
30283023

30293024
capital-case@^1.0.4:
30303025
version "1.0.4"

0 commit comments

Comments
 (0)