Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: onboarding flow in Brave #1011

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions add-on/src/lib/ipfs-client/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ exports.destroy = async function (browser) {
// ipfs:// URI that will be used for triggering the "Enable IPFS" dropbar in Brave
// Here we use inlined empty byte array, which resolves instantly and does not
// introduce any delay in UI.
const braveIpfsUriTrigger = 'ipfs://bafkqaaa/'
const braveGatewayUrlTrigger = 'https://bafkqaaa.ipfs.dweb.link/'
const braveIpfsUriTrigger = 'ipfs://bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss/'
const braveGatewayUrlTrigger = 'https://bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss.ipfs.dweb.link/'

// Settings screen in Brave where user can manage IPFS support
const braveSettingsPage = 'brave://settings/extensions'
Expand Down Expand Up @@ -245,10 +245,10 @@ async function activationUiCleanup (browser) {
try {
// after useBraveEndpoint we can start polling for gateway to become online
const { customGatewayUrl: braveGwUrl } = await browser.storage.local.get('customGatewayUrl')
// wait 1m for gateway to be online (bafkqaaa)
// wait 1m for gateway to be online (bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss)
await waitFor(async () => {
try {
return await fetch(`${braveGwUrl}/ipfs/bafkqaaa`).then(response => response.ok)
return await fetch(`${braveGwUrl}/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss`).then(response => response.ok)
} catch (_) {
return false
}
Expand Down
6 changes: 3 additions & 3 deletions test/functional/lib/ipfs-request-workarounds.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ describe('modifyRequest processing', function () {
it('should force native URI in address bar via tabs.update API', async function () {
const httpDNSLinkUrl = 'https://example.com/ipns/docs.ipfs.io/some/path?query=val'
const nativeDNSLinkUri = 'ipns://docs.ipfs.io/some/path?query=val'
spoofDnsTxtRecord('docs.ipfs.io', dnslinkResolver, '/ipfs/bafkqaaa')
spoofDnsTxtRecord('docs.ipfs.io', dnslinkResolver, '/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss')
state.ipfsNodeType = braveNodeType
// ensure clean modifyRequest
runtime = Object.assign({}, await createRuntimeChecks(browser)) // make it mutable for tests
Expand All @@ -330,7 +330,7 @@ describe('modifyRequest processing', function () {
const request = {
method: 'GET',
type: 'image',
url: 'https://ipfs.io/ipfs/bafkqaaa',
url: 'https://ipfs.io/ipfs/bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss',
initiator: 'https://some-website.example.com' // Brave (built on Chromium)
}
expect(modifyRequest.onBeforeRequest(request))
Expand All @@ -339,7 +339,7 @@ describe('modifyRequest processing', function () {
it('should be left untouched if subresource (would be blocked by Brave Shields)', function () {
runtime.isFirefox = false
runtime.brave = { thisIsFakeBraveRuntime: true }
const cid = 'bafkqaaa'
const cid = 'bafkqae2xmvwgg33nmuqhi3zajfiemuzahiwss'
const request = {
method: 'GET',
type: 'main_frame',
Expand Down
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3016,15 +3016,10 @@ camelcase@^6.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.1.0.tgz#27dc176173725fb0adf8a48b647f4d7871944d78"
integrity sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ==

caniuse-lite@^1.0.30001135:
version "1.0.30001151"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001151.tgz#1ddfde5e6fff02aad7940b4edb7d3ac76b0cb00b"
integrity sha512-Zh3sHqskX6mHNrqUerh+fkf0N72cMxrmflzje/JyVImfpknscMnkeJrlFGJcqTmaa0iszdYptGpWMJCRQDkBVw==

caniuse-lite@^1.0.30001181:
version "1.0.30001198"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001198.tgz#ed2d9b5f060322ba2efa42afdc56dee3255473f4"
integrity sha512-r5GGgESqOPZzwvdLVER374FpQu2WluCF1Z2DSiFJ89KSmGjT0LVKjgv4NcAqHmGWF9ihNpqRI9KXO9Ex4sKsgA==
caniuse-lite@^1.0.30001135, caniuse-lite@^1.0.30001181:
version "1.0.30001238"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001238.tgz"
integrity sha512-bZGam2MxEt7YNsa2VwshqWQMwrYs5tR5WZQRYSuFxsBQunWjBuXhN4cS9nV5FFb1Z9y+DoQcQ0COyQbv6A+CKw==

capital-case@^1.0.4:
version "1.0.4"
Expand Down