-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UX fixes around embedded js-ipfs and automatic mode
- suspend automatic mode while embedded node is active - redirect to public gateway instead of custom one when running js-ipfs - fix UX when starting with external API being offline (#373) - extract some reusable feature-detection functions - open public gateway instead of custom one when uploading a file using embedded js-ipfs under Firefox - some tests
- Loading branch information
Showing
9 changed files
with
343 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"applications": { | ||
"gecko": { | ||
"id": "[email protected]", | ||
"strict_min_version": "57.0" | ||
"strict_min_version": "58.0" | ||
} | ||
}, | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,44 @@ | ||
'use strict' | ||
const { describe, it } = require('mocha') | ||
const { describe, it, before, after } = require('mocha') | ||
const { expect } = require('chai') | ||
const { URL } = require('url') | ||
const createDnsLink = require('../../../add-on/src/lib/dns-link') | ||
|
||
// https://github.com/ipfs/ipfs-companion/issues/303 | ||
describe('DNSLINK', function () { | ||
describe('redirectToIpnsPath(url)', function () { | ||
before(() => { | ||
global.URL = URL | ||
}) | ||
|
||
describe('redirectToIpnsPath(url) with external gateway', function () { | ||
it('should return IPNS path at a custom gateway', function () { | ||
const url = new URL('http://ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') | ||
const getState = () => ({ gwURL: new URL('http://127.0.0.1:8080') }) | ||
const getState = () => ({ | ||
gwURL: new URL('http://127.0.0.1:8080'), | ||
pubGwURL: new URL('https://ipfs.io'), | ||
ipfsNodeType: 'external' | ||
}) | ||
const dnsLink = createDnsLink(getState) | ||
expect(dnsLink.redirectToIpnsPath(url).redirectUrl) | ||
.to.equal('http://127.0.0.1:8080/ipns/ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') | ||
}) | ||
}) | ||
|
||
describe('redirectToIpnsPath(url) with embedded gateway', function () { | ||
it('should return IPNS path at a public gateway', function () { | ||
const url = new URL('http://ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') | ||
const getState = () => ({ | ||
gwURL: new URL('http://127.0.0.1:8080'), | ||
pubGwURL: new URL('https://ipfs.io'), | ||
ipfsNodeType: 'embedded' | ||
}) | ||
const dnsLink = createDnsLink(getState) | ||
expect(dnsLink.redirectToIpnsPath(url).redirectUrl) | ||
.to.equal('https://ipfs.io/ipns/ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') | ||
}) | ||
}) | ||
|
||
after(() => { | ||
delete global.URL | ||
}) | ||
}) |
Oops, something went wrong.