-
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.
Merge branch 'feat/upgrade-deps' of github.com:tableflip/ipfs-compani…
…on into feat/upgrade-deps
- Loading branch information
Showing
14 changed files
with
465 additions
and
42 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
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict' | ||
/* eslint-env browser, webextensions */ | ||
|
||
function getBrowserInfo (browser) { | ||
if (browser && browser.runtime && browser.runtime.getBrowserInfo) { | ||
return browser.runtime.getBrowserInfo() | ||
} | ||
return Promise.resolve() | ||
} | ||
|
||
function getPlatformInfo (browser) { | ||
if (browser && browser.runtime && browser.runtime.getPlatformInfo) { | ||
return browser.runtime.getPlatformInfo() | ||
} | ||
return Promise.resolve() | ||
} | ||
|
||
async function createRuntimeChecks (browser) { | ||
// browser | ||
const browserInfo = await getBrowserInfo(browser) | ||
const runtimeBrowserName = browserInfo ? browserInfo.name : 'unknown' | ||
const runtimeIsFirefox = !!runtimeBrowserName.match('Firefox') | ||
const runtimeHasNativeProtocol = !!(browser && browser.protocol && browser.protocol.registerStringProtocol) | ||
// platform | ||
const platformInfo = await getPlatformInfo(browser) | ||
const runtimeIsAndroid = platformInfo ? platformInfo.os === 'android' : false | ||
// | ||
return Object.freeze({ | ||
isFirefox: runtimeIsFirefox, | ||
isAndroid: runtimeIsAndroid, | ||
hasNativeProtocolHandler: runtimeHasNativeProtocol | ||
}) | ||
} | ||
|
||
module.exports = createRuntimeChecks |
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 () { | ||
it('should return IPNS path at a custom gateway', function () { | ||
before(() => { | ||
global.URL = URL | ||
}) | ||
|
||
describe('redirectToIpnsPath(url) with external gateway', function () { | ||
it('should return IPNS path at a custom gateway', async 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', async 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.