From b3204073ddb688d63b8ffb7066011440fb0bf9f6 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 1 Dec 2017 15:37:55 +0000 Subject: [PATCH 1/9] adds directory viewer --- add-on/src/lib/ipfs-companion.js | 38 ++++++++++++++++--------------- add-on/src/lib/ipfs-protocol.js | 39 ++++++++++++++++++++++++++++---- package.json | 2 +- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/add-on/src/lib/ipfs-companion.js b/add-on/src/lib/ipfs-companion.js index 8e2381c0e..cac67042a 100644 --- a/add-on/src/lib/ipfs-companion.js +++ b/add-on/src/lib/ipfs-companion.js @@ -144,25 +144,27 @@ module.exports = async function init () { } async function sendStatusUpdateToBrowserAction () { - if (browserActionPort) { - const info = { - ipfsNodeType: state.ipfsNodeType, - peerCount: state.peerCount, - gwURLString: state.gwURLString, - pubGwURLString: state.pubGwURLString, - currentTab: await browser.tabs.query({active: true, currentWindow: true}).then(tabs => tabs[0]) - } - try { - let v = await ipfs.version() - if (v) { - info.gatewayVersion = v.commit ? v.version + '/' + v.commit : v.version - } - } catch (error) { - info.gatewayVersion = null - } - if (info.currentTab) { - info.ipfsPageActionsContext = ipfsPathValidator.isIpfsPageActionsContext(info.currentTab.url) + if (!browserActionPort) return + const info = { + ipfsNodeType: state.ipfsNodeType, + peerCount: state.peerCount, + gwURLString: state.gwURLString, + pubGwURLString: state.pubGwURLString, + currentTab: await browser.tabs.query({active: true, currentWindow: true}).then(tabs => tabs[0]) + } + try { + let v = await ipfs.version() + if (v) { + info.gatewayVersion = v.commit ? v.version + '/' + v.commit : v.version } + } catch (error) { + info.gatewayVersion = null + } + if (info.currentTab) { + info.ipfsPageActionsContext = ipfsPathValidator.isIpfsPageActionsContext(info.currentTab.url) + } + // Still here? + if (browserActionPort) { browserActionPort.postMessage({statusUpdate: info}) } } diff --git a/add-on/src/lib/ipfs-protocol.js b/add-on/src/lib/ipfs-protocol.js index 1901dd329..828205dee 100644 --- a/add-on/src/lib/ipfs-protocol.js +++ b/add-on/src/lib/ipfs-protocol.js @@ -1,11 +1,19 @@ +const bl = require('bl') const { mimeSniff } = require('./mime-sniff') +const dirView = require('ipfs/src/http/gateway/dir-view') +const PathUtils = require('ipfs/src/http/gateway/utils/path') exports.createIpfsUrlProtocolHandler = (getIpfs) => { return async (request, reply) => { console.time('[ipfs-companion] IpfsUrlProtocolHandler') console.log(`[ipfs-companion] handling ${request.url}`) - const path = request.url.split('ipfs://')[1] + let path = request.url.replace('ipfs://', '/') + + if (path.indexOf('/ipfs') !== 0) { + path = `/ipfs${path}` + } + const ipfs = getIpfs() try { @@ -13,6 +21,7 @@ exports.createIpfsUrlProtocolHandler = (getIpfs) => { console.log(`[ipfs-companion] returning ${path} as ${mimeType}`) reply({mimeType, data}) } catch (err) { + console.error('[ipfs-companion] failed to get data', err) reply({mimeType: 'text/html', data: `Error ${err.message}`}) } @@ -22,10 +31,30 @@ exports.createIpfsUrlProtocolHandler = (getIpfs) => { function getDataAndGuessMimeType (ipfs, path) { return new Promise((resolve, reject) => { - ipfs.files.cat(path, (err, res) => { - if (err) return reject(err) - const mimeType = mimeSniff(res, path) - resolve({mimeType, data: res.toString('utf8')}) + ipfs.files.cat(path, async (err, stream) => { + if (err) { + if (err.message.toLowerCase() === 'this dag node is a directory') { + return resolve(await getDirectoryListingOrIndexData(ipfs, path)) + } + return reject(err) + } + + stream.pipe(bl((err, data) => { + if (err) return reject(err) + const mimeType = mimeSniff(data, path) + resolve({mimeType, data: data.toString('utf8')}) + })) }) }) } + +async function getDirectoryListingOrIndexData (ipfs, path) { + const listing = await ipfs.ls(path) + const index = listing.find((l) => ['index.html', 'index.htm'].includes(l.name)) + + if (index) { + return getDataAndGuessMimeType(ipfs, PathUtils.joinURLParts(path, index.name)) + } + + return {mimeType: 'text/html', data: dirView.render(path.replace(/^\/ipfs/, ''), listing)} +} diff --git a/package.json b/package.json index ae98d5646..487c802f5 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "ipfs": "0.27.3", "ipfs-api": "17.1.3", "is-ipfs": "0.3.2", - "is-svg": "2.1.0", + "is-svg": "^2.1.0", "lru_map": "0.3.3", "mime-types": "2.1.17", "prundupify": "1.0.0", From f11ec48292cb760d09ed40a3d5afb46710fea13a Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 1 Dec 2017 17:20:39 +0000 Subject: [PATCH 2/9] fixes response handling from ipfs.files.cat --- add-on/src/lib/ipfs-protocol.js | 34 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/add-on/src/lib/ipfs-protocol.js b/add-on/src/lib/ipfs-protocol.js index 828205dee..355987c49 100644 --- a/add-on/src/lib/ipfs-protocol.js +++ b/add-on/src/lib/ipfs-protocol.js @@ -1,4 +1,3 @@ -const bl = require('bl') const { mimeSniff } = require('./mime-sniff') const dirView = require('ipfs/src/http/gateway/dir-view') const PathUtils = require('ipfs/src/http/gateway/utils/path') @@ -29,23 +28,20 @@ exports.createIpfsUrlProtocolHandler = (getIpfs) => { } } -function getDataAndGuessMimeType (ipfs, path) { - return new Promise((resolve, reject) => { - ipfs.files.cat(path, async (err, stream) => { - if (err) { - if (err.message.toLowerCase() === 'this dag node is a directory') { - return resolve(await getDirectoryListingOrIndexData(ipfs, path)) - } - return reject(err) - } - - stream.pipe(bl((err, data) => { - if (err) return reject(err) - const mimeType = mimeSniff(data, path) - resolve({mimeType, data: data.toString('utf8')}) - })) - }) - }) +async function getDataAndGuessMimeType (ipfs, path) { + let data + + try { + data = await ipfs.files.cat(path) + } catch (err) { + if (err.message.toLowerCase() === 'this dag node is a directory') { + return getDirectoryListingOrIndexData(ipfs, path) + } + throw err + } + + const mimeType = mimeSniff(data, path) + return {mimeType, data: data.toString('utf8')} } async function getDirectoryListingOrIndexData (ipfs, path) { @@ -56,5 +52,5 @@ async function getDirectoryListingOrIndexData (ipfs, path) { return getDataAndGuessMimeType(ipfs, PathUtils.joinURLParts(path, index.name)) } - return {mimeType: 'text/html', data: dirView.render(path.replace(/^\/ipfs/, ''), listing)} + return {mimeType: 'text/html', data: dirView.render(path, listing)} } From 8044f9bcc6bf2685073df90a0c8e5300e386859c Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 4 Dec 2017 09:31:14 +0000 Subject: [PATCH 3/9] fixes and tweaks --- add-on/src/lib/dir-view.js | 79 +++++++++++++++++++++++++++++++++ add-on/src/lib/ipfs-protocol.js | 9 ++-- 2 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 add-on/src/lib/dir-view.js diff --git a/add-on/src/lib/dir-view.js b/add-on/src/lib/dir-view.js new file mode 100644 index 000000000..f0850051f --- /dev/null +++ b/add-on/src/lib/dir-view.js @@ -0,0 +1,79 @@ +'use strict' + +const filesize = require('filesize') +const mainStyle = require('ipfs/src/http/gateway/dir-view/style') + +function buildFilesList (path, links) { + const rows = links.map((link) => { + let row = [ + `
 
`, + `${link.name}`, + filesize(link.size) + ] + + row = row.map((cell) => `${cell}`).join('') + + return `${row}` + }) + + return rows.join('') +} + +function isRoot (path) { + // Remove leading ipfs// and trailing / and split by / + const parts = path.replace(/^ipfs:\/\//, '').replace(/\/$/, '').split('/') + // If there's only 1 part, then it's the hash, so we are at root + return parts.length === 1 +} + +function buildTable (path, links) { + return ` + + + ${isRoot(path) ? '' : (` + + + + + + `)} + ${buildFilesList(path, links)} + +
+
 
+
+ .. +
+ ` +} + +function render (path, links) { + return ` + + + + + ${path} + + + + +
+
+
+
+ Index of ${path} +
+ ${buildTable(path, links)} +
+
+ + + ` +} + +exports.render = render diff --git a/add-on/src/lib/ipfs-protocol.js b/add-on/src/lib/ipfs-protocol.js index 355987c49..ccd0bf9a8 100644 --- a/add-on/src/lib/ipfs-protocol.js +++ b/add-on/src/lib/ipfs-protocol.js @@ -1,5 +1,5 @@ const { mimeSniff } = require('./mime-sniff') -const dirView = require('ipfs/src/http/gateway/dir-view') +const dirView = require('./dir-view') const PathUtils = require('ipfs/src/http/gateway/utils/path') exports.createIpfsUrlProtocolHandler = (getIpfs) => { @@ -8,10 +8,7 @@ exports.createIpfsUrlProtocolHandler = (getIpfs) => { console.log(`[ipfs-companion] handling ${request.url}`) let path = request.url.replace('ipfs://', '/') - - if (path.indexOf('/ipfs') !== 0) { - path = `/ipfs${path}` - } + path = path.startsWith('/ipfs') ? path : `/ipfs${path}` const ipfs = getIpfs() @@ -52,5 +49,5 @@ async function getDirectoryListingOrIndexData (ipfs, path) { return getDataAndGuessMimeType(ipfs, PathUtils.joinURLParts(path, index.name)) } - return {mimeType: 'text/html', data: dirView.render(path, listing)} + return {mimeType: 'text/html', data: dirView.render(path.replace(/^\/ipfs\//, 'ipfs://'), listing)} } From 49643c73027d702ed3abb945adb2c7fcefe63b8e Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 11 Dec 2017 17:10:06 +0000 Subject: [PATCH 4/9] upgrades IPFS --- yarn.lock | 391 ++++++++++++++++-------------------------------------- 1 file changed, 113 insertions(+), 278 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0efb0b4f3..15fe12968 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3,8 +3,8 @@ "@types/node@*": - version "8.0.53" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8" + version "8.0.58" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.58.tgz#5b3881c0be3a646874803fee3197ea7f1ed6df90" JSONSelect@0.2.1: version "0.2.1" @@ -91,7 +91,7 @@ acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.0.0, acorn@^5.2.1: +acorn@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" @@ -158,8 +158,8 @@ ajv@^4.7.0, ajv@^4.9.1: json-stable-stringify "^1.0.1" ajv@^5.1.0, ajv@^5.2.0, ajv@^5.2.3: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" + version "5.5.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.1.tgz#b38bb8876d9e86bee994956a04e721e88b248eb2" dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -348,7 +348,7 @@ asn1.js@1.0.3: optionalDependencies: bn.js "^1.0.0" -asn1.js@^4.0.0, asn1.js@^4.9.1: +asn1.js@^4.0.0: version "4.9.2" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.2.tgz#8117ef4f7ed87cd8f89044b5bff97ac243a16c9a" dependencies: @@ -918,8 +918,8 @@ base-x@3.0.0: resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.0.tgz#77b56f0311070b780b3c8a5f534beac47e506702" base-x@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.2.tgz#bf873861b7514279b7969f340929eab87c11d130" + version "3.0.3" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.3.tgz#7870aebb757a49d38d7cf63a6c554c418287cce7" dependencies: safe-buffer "^5.0.1" @@ -968,8 +968,8 @@ bignumber.js@~3.0.0: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-3.0.1.tgz#807652d10e39de37e9e3497247edc798bb746f76" binary-extensions@^1.0.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.10.0.tgz#9aeb9a6c5e88638aad171e167f5900abe24835d0" + version "1.11.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" binary-querystring@~0.1.2: version "0.1.2" @@ -1082,8 +1082,8 @@ boundary@^1.0.1: resolved "https://registry.yarnpkg.com/boundary/-/boundary-1.0.1.tgz#4d67dc2602c0cc16dd9bce7ebf87e948290f5812" boxen@^1.0.0, boxen@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.2.2.tgz#3f1d4032c30ffea9d4b02c322eaf2ea741dcbce5" + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" dependencies: ansi-align "^2.0.0" camelcase "^4.0.0" @@ -1091,7 +1091,7 @@ boxen@^1.0.0, boxen@^1.2.1: cli-boxes "^1.0.0" string-width "^2.0.0" term-size "^1.2.0" - widest-line "^1.0.0" + widest-line "^2.0.0" brace-expansion@^1.1.7: version "1.1.8" @@ -1114,15 +1114,6 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" -brfs@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/brfs/-/brfs-1.4.3.tgz#db675d6f5e923e6df087fca5859c9090aaed3216" - dependencies: - quote-stream "^1.0.1" - resolve "^1.1.5" - static-module "^1.1.0" - through2 "^2.0.0" - brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -1157,7 +1148,7 @@ browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" -browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6, browserify-aes@^1.0.8, browserify-aes@^1.1.1: +browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6, browserify-aes@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f" dependencies: @@ -1298,10 +1289,6 @@ buffer-equal-constant-time@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" -buffer-equal@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-0.0.1.tgz#91bc74b11ea405bc916bc6aa908faafa5b4aac4b" - buffer-equals@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/buffer-equals/-/buffer-equals-1.0.4.tgz#0353b54fd07fd9564170671ae6f66b9cf10d27f5" @@ -1495,8 +1482,8 @@ character-reference-invalid@^1.0.0: resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.1.tgz#942835f750e4ec61a308e60c2ef8cc1011202efc" chardet@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.0.tgz#0bbe1355ac44d7a3ed4a925707c4ef70f8190f6c" + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" check-error@^1.0.1: version "1.0.2" @@ -1550,8 +1537,8 @@ chownr@^1.0.1: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" ci-info@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.1.tgz#47b44df118c48d2597b56d342e7e25791060171a" + version "1.1.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" cids@^0.5.2, cids@~0.5.1, cids@~0.5.2: version "0.5.2" @@ -1685,7 +1672,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@2.11.0, commander@^2.6.0, commander@^2.9.0: +commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" @@ -1695,7 +1682,7 @@ commander@2.9.0: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.11.0, commander@^2.9: +commander@^2.11.0, commander@^2.6.0, commander@^2.9, commander@^2.9.0: version "2.12.2" resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" @@ -1734,7 +1721,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.7, concat-stream@^1.5.2, concat-stream@^1.6.0, concat-stream@~1.6.0: +concat-stream@^1.4.7, concat-stream@^1.5.2, concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -1799,8 +1786,8 @@ content@3.x.x, content@^3.0.0: boom "5.x.x" convert-source-map@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + version "1.5.1" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" convert-source-map@~1.1.0: version "1.1.3" @@ -1811,8 +1798,8 @@ cookie@0.3.1: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" core-js@^2.2.0, core-js@^2.4.0, core-js@^2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" + version "2.5.3" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e" core-js@~2.3.0: version "2.3.0" @@ -2181,18 +2168,18 @@ detect-indent@^4.0.0: repeating "^2.0.0" detect-libc@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.2.tgz#71ad5d204bf17a6a6ca8f450c61454066ef461e1" + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" detect-node@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127" detective@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/detective/-/detective-4.5.0.tgz#6e5a8c6b26e6c7a254b1c6b6d7490d98ec91edd1" + version "4.7.0" + resolved "https://registry.yarnpkg.com/detective/-/detective-4.7.0.tgz#6276e150f9e50829ad1f90ace4d9a2304188afcf" dependencies: - acorn "^4.0.3" + acorn "^5.2.1" defined "^1.0.0" di@^0.0.1: @@ -2266,11 +2253,10 @@ doctrine@1.5.0, doctrine@^1.2.2: isarray "^1.0.0" doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" + version "2.0.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" dependencies: esutils "^2.0.2" - isarray "^1.0.0" document-ready@^2.0.1: version "2.0.1" @@ -2350,12 +2336,6 @@ duplexer2@^0.1.2, duplexer2@^0.1.4, duplexer2@~0.1.0, duplexer2@~0.1.2: dependencies: readable-stream "^2.0.2" -duplexer2@~0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" - dependencies: - readable-stream "~1.1.9" - duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" @@ -2515,10 +2495,10 @@ epimetheus@^1.0.55: prom-client "^10.0.0" errno@~0.1.1: - version "0.1.4" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" + version "0.1.5" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.5.tgz#a563781a6052bc2c9ccd89e8cef0eb9506e0c321" dependencies: - prr "~0.0.0" + prr "~1.0.1" error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.1" @@ -2527,8 +2507,8 @@ error-ex@^1.2.0, error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.4.3, es-abstract@^1.7.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227" + version "1.10.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" dependencies: es-to-primitive "^1.1.1" function-bind "^1.1.1" @@ -2545,8 +2525,8 @@ es-to-primitive@^1.1.1: is-symbol "^1.0.1" es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.35" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.35.tgz#18ee858ce6a3c45c7d79e91c15fcca9ec568494f" + version "0.10.37" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.37.tgz#0ee741d148b80069ba27d020393756af257defc3" dependencies: es6-iterator "~2.0.1" es6-symbol "~3.1.1" @@ -2645,25 +2625,6 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" -escodegen@~0.0.24: - version "0.0.28" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-0.0.28.tgz#0e4ff1715f328775d6cab51ac44a406cd7abffd3" - dependencies: - esprima "~1.0.2" - estraverse "~1.3.0" - optionalDependencies: - source-map ">= 0.1.2" - -escodegen@~1.3.2: - version "1.3.3" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.3.3.tgz#f024016f5a88e046fd12005055e939802e6c5f23" - dependencies: - esprima "~1.1.1" - estraverse "~1.5.0" - esutils "~1.0.0" - optionalDependencies: - source-map "~0.1.33" - escope@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" @@ -2853,14 +2814,6 @@ esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" -esprima@~1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" - -esprima@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549" - esquery@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" @@ -2882,22 +2835,10 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -estraverse@~1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.3.2.tgz#37c2b893ef13d723f276d878d60d8535152a6c42" - -estraverse@~1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.5.1.tgz#867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71" - esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -esutils@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.0.0.tgz#8151d358e20c8acc7fb745e7472c0025fe496570" - ethereum-common@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca" @@ -2930,7 +2871,7 @@ ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.3: ethereum-common "^0.0.18" ethereumjs-util "^5.0.0" -ethereumjs-util@^4.0.0, ethereumjs-util@^4.0.1: +ethereumjs-util@^4.0.1: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -3069,10 +3010,14 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" -extsprintf@1.3.0, extsprintf@^1.2.0: +extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + factor-bundle@2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/factor-bundle/-/factor-bundle-2.5.0.tgz#8ea8957da39d7586283cc3ee353cd9911a45e779" @@ -3098,15 +3043,6 @@ fakefile@0.0.9: dependencies: fs-extra "0.26.5" -falafel@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/falafel/-/falafel-2.1.0.tgz#96bb17761daba94f46d001738b3cedf3a67fe06c" - dependencies: - acorn "^5.0.0" - foreach "^2.0.5" - isarray "0.0.1" - object-keys "^1.0.6" - fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" @@ -3436,8 +3372,8 @@ gauge@~2.7.3: wide-align "^1.1.0" gc-stats@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/gc-stats/-/gc-stats-1.0.2.tgz#4d9ec98441e19888205452062ad6da30c9876e11" + version "1.1.0" + resolved "https://registry.yarnpkg.com/gc-stats/-/gc-stats-1.1.0.tgz#3942e449d87c8fa23412c68969b89dcd76569af3" dependencies: nan "^2.6.2" node-pre-gyp "^0.6.36" @@ -3998,14 +3934,10 @@ inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" -ini@^1.3.4: +ini@^1.3.4, ini@~1.3.0, ini@~1.3.3: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" -ini@~1.3.0, ini@~1.3.3: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" - inline-source-map@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.5.0.tgz#4a4c5dd8e4fb5e9b3cda60c822dfadcaee66e0af" @@ -4085,8 +4017,8 @@ interface-datastore@^0.4.2, interface-datastore@~0.4.0, interface-datastore@~0.4 uuid "^3.1.0" interpret@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" + version "1.1.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" invariant@^2.2.2: version "2.2.2" @@ -4099,17 +4031,16 @@ invert-kv@^1.0.0: resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" ip-address@^5.8.8: - version "5.8.8" - resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-5.8.8.tgz#5fd1f8f7465249fb7d2b3c1eec7b41d29d1f1b76" + version "5.8.9" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-5.8.9.tgz#6379277c23fc5adb20511e4d23ec2c1bde105dfd" dependencies: - jsbn "0.1.0" + jsbn "1.1.0" lodash.find "^4.6.0" lodash.max "^4.0.1" lodash.merge "^4.6.0" lodash.padstart "^4.6.1" lodash.repeat "^4.1.0" - sprintf-js "^1.0.3" - util-deprecate "^1.0.2" + sprintf-js "1.1.0" ip@^1.1.0, ip@^1.1.5: version "1.1.5" @@ -4230,8 +4161,8 @@ ipfs-multipart@~0.1.0: dicer "^0.2.5" ipfs-repo@~0.18.2, ipfs-repo@~0.18.4: - version "0.18.4" - resolved "https://registry.yarnpkg.com/ipfs-repo/-/ipfs-repo-0.18.4.tgz#2a6e5ae1269bb2010b8558e9affeda88aeb0670e" + version "0.18.5" + resolved "https://registry.yarnpkg.com/ipfs-repo/-/ipfs-repo-0.18.5.tgz#49d12ac2b46fb38332b10af66ad460329a29bc91" dependencies: async "^2.6.0" base32.js "~0.1.0" @@ -4380,8 +4311,8 @@ ipld-dag-cbor@~0.11.2: traverse "^0.6.6" ipld-dag-pb@~0.11.3: - version "0.11.3" - resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.11.3.tgz#82851de59e8ff52529012da308644a7e6f90eaef" + version "0.11.4" + resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.11.4.tgz#b0fae5681fad5697132e325d6c2ff17b5f0cb6a8" dependencies: async "^2.6.0" bs58 "^4.0.1" @@ -4631,8 +4562,8 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-inside@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" @@ -4692,7 +4623,7 @@ is-stream@^1.0.0, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -is-svg@2.1.0: +is-svg@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-2.1.0.tgz#cf61090da0d9efbcab8722deba6f032208dbb0e9" dependencies: @@ -4868,9 +4799,9 @@ js-yaml@3.x, js-yaml@^3.5.1, js-yaml@^3.9.1: argparse "^1.0.7" esprima "^4.0.0" -jsbn@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" jsbn@~0.1.0: version "0.1.1" @@ -5009,8 +4940,8 @@ jws@^3.1.3: safe-buffer "^5.0.1" k-bucket@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/k-bucket/-/k-bucket-3.3.0.tgz#cf18eb3407ff12f9fc2f90cbe832fb66999b2989" + version "3.3.1" + resolved "https://registry.yarnpkg.com/k-bucket/-/k-bucket-3.3.1.tgz#de219f00b310ca17fdd7e2790a077d78b70d92c8" dependencies: buffer-equals "^1.0.3" inherits "^2.0.1" @@ -5096,13 +5027,12 @@ karma@1.7.1: useragent "^2.1.12" keccak@^1.0.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.3.0.tgz#3681bd99ad3d0354ddb29b9040c1b6560cce08ac" + version "1.4.0" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" dependencies: bindings "^1.2.1" inherits "^2.0.3" nan "^2.2.1" - prebuild-install "^2.0.0" safe-buffer "^5.1.0" keccakjs@^0.2.0: @@ -5223,7 +5153,7 @@ level-js@^2.2.4: typedarray-to-buffer "~1.0.0" xtend "~2.1.2" -level-js@timkuijsten/level.js#idbunwrapper: +"level-js@github:timkuijsten/level.js#idbunwrapper": version "2.2.3" resolved "https://codeload.github.com/timkuijsten/level.js/tar.gz/18e03adab34c49523be7d3d58fafb0c632f61303" dependencies: @@ -5305,7 +5235,7 @@ libp2p-crypto-secp256k1@~0.2.2: safe-buffer "^5.1.1" secp256k1 "^3.3.0" -libp2p-crypto@^0.10.4, libp2p-crypto@~0.10.4: +libp2p-crypto@^0.10.4, libp2p-crypto@~0.10.0, libp2p-crypto@~0.10.3, libp2p-crypto@~0.10.4: version "0.10.4" resolved "https://registry.yarnpkg.com/libp2p-crypto/-/libp2p-crypto-0.10.4.tgz#24fd3f5291fdd8055bc33099e5c9b84fefdf8220" dependencies: @@ -5321,22 +5251,6 @@ libp2p-crypto@^0.10.4, libp2p-crypto@~0.10.4: tweetnacl "^1.0.0" webcrypto-shim "github:dignifiedquire/webcrypto-shim#master" -libp2p-crypto@~0.10.0, libp2p-crypto@~0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/libp2p-crypto/-/libp2p-crypto-0.10.3.tgz#00f84fdfe7a8b334aa1cb9090a44bb066dce3522" - dependencies: - asn1.js "^4.9.1" - async "^2.5.0" - browserify-aes "^1.0.8" - keypair "^1.0.1" - libp2p-crypto-secp256k1 "~0.2.2" - multihashing-async "~0.4.6" - pem-jwk "^1.5.1" - protons "^1.0.0" - rsa-pem-to-jwk "^1.1.3" - tweetnacl "^1.0.0" - webcrypto-shim "github:dignifiedquire/webcrypto-shim#master" - libp2p-floodsub@~0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.13.1.tgz#b396f1a401130ecf03899c04c95eef92eaa47fab" @@ -5746,8 +5660,8 @@ lolex@^1.6.0: resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" lolex@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.0.tgz#d6bad0f0aa5caebffcfebb09fb2caa89baaff51c" + version "2.3.1" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.1.tgz#3d2319894471ea0950ef64692ead2a5318cff362" longest-streak@^1.0.0: version "1.0.0" @@ -5890,11 +5804,11 @@ merge@^1.2.0: resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.2.0.tgz#7a4787b1262ab00fe9b204ab471b005332306efa" + version "2.3.0" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.0.tgz#84c606232ef343f1b96fc972e697708754f08573" dependencies: async "^1.4.2" - ethereumjs-util "^4.0.0" + ethereumjs-util "^5.0.0" level-ws "0.0.0" levelup "^1.2.1" memdown "^1.0.0" @@ -5928,8 +5842,8 @@ miller-rabin@^4.0.0: brorand "^1.0.1" mime-db@1.x.x: - version "1.31.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.31.0.tgz#a49cd8f3ebf3ed1a482b60561d9105ad40ca74cb" + version "1.32.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.32.0.tgz#485b3848b01a3cda5f968b4882c0771e58e09414" mime-db@~1.30.0: version "1.30.0" @@ -5941,11 +5855,7 @@ mime-types@2.1.17, mime-types@^2.1.12, mime-types@^2.1.17, mime-types@~2.1.11, m dependencies: mime-db "~1.30.0" -mime@^1.3.4: - version "1.4.1" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" - -mime@^1.3.6: +mime@^1.3.4, mime@^1.3.6: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" @@ -6048,8 +5958,8 @@ module-deps@^4.0.8: xtend "^4.0.0" moment@2.x.x, moment@^2.10.6: - version "2.19.2" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe" + version "2.19.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.4.tgz#17e5e2c6ead8819c8ecfad83a0acccb312e94682" ms@0.7.1: version "0.7.1" @@ -6115,7 +6025,7 @@ multihashing-async@~0.4.6, multihashing-async@~0.4.7: murmurhash3js "^3.0.1" nodeify "^1.0.1" -multiplex@dignifiedquire/multiplex: +"multiplex@github:dignifiedquire/multiplex": version "6.7.0" resolved "https://codeload.github.com/dignifiedquire/multiplex/tar.gz/b5d5edd30454e2c978ee8c52df86f5f4840d2eab" dependencies: @@ -6431,11 +6341,7 @@ object-component@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" -object-inspect@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-0.4.0.tgz#f5157c116c1455b243b06ee97703392c5ad89fec" - -object-keys@^1.0.10, object-keys@^1.0.6, object-keys@^1.0.8: +object-keys@^1.0.10, object-keys@^1.0.8: version "1.0.11" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" @@ -6761,7 +6667,7 @@ peer-book@~0.5.2: peer-id "^0.10.3" peer-info "^0.11.3" -peer-id@^0.10.2, peer-id@^0.10.3, peer-id@~0.10.3: +peer-id@^0.10.2, peer-id@^0.10.3, peer-id@~0.10.0, peer-id@~0.10.1, peer-id@~0.10.2, peer-id@~0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/peer-id/-/peer-id-0.10.3.tgz#ed51144c4556545af3001c73f5e36bb6dc2c2708" dependencies: @@ -6770,24 +6676,7 @@ peer-id@^0.10.2, peer-id@^0.10.3, peer-id@~0.10.3: lodash "^4.17.4" multihashes "~0.4.12" -peer-id@~0.10.0, peer-id@~0.10.1, peer-id@~0.10.2: - version "0.10.2" - resolved "https://registry.yarnpkg.com/peer-id/-/peer-id-0.10.2.tgz#88cefb53b13a5135e78be51e7f32a107fb3916bb" - dependencies: - async "^2.5.0" - libp2p-crypto "~0.10.3" - lodash "^4.17.4" - multihashes "~0.4.9" - -peer-info@^0.11.0, peer-info@~0.11.0, peer-info@~0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/peer-info/-/peer-info-0.11.1.tgz#50b9b31b6a260efdba747efc2df3ca74e5117dbc" - dependencies: - lodash.uniqby "^4.7.0" - multiaddr "^3.0.1" - peer-id "~0.10.2" - -peer-info@^0.11.3, peer-info@~0.11.3: +peer-info@^0.11.0, peer-info@^0.11.3, peer-info@~0.11.0, peer-info@~0.11.1, peer-info@~0.11.3: version "0.11.3" resolved "https://registry.yarnpkg.com/peer-info/-/peer-info-0.11.3.tgz#898d898a954fe215608f7ceb94461cb810c22b02" dependencies: @@ -6908,9 +6797,9 @@ postcss@6.0.11: source-map "^0.5.7" supports-color "^4.4.0" -prebuild-install@^2.0.0, prebuild-install@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.3.0.tgz#19481247df728b854ab57b187ce234211311b485" +prebuild-install@^2.1.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.4.1.tgz#c28ba1d1eedc17fbd6b3229a657ffc0fba479b49" dependencies: expand-template "^1.0.2" github-from-package "0.0.0" @@ -6992,19 +6881,14 @@ protocol-buffers-schema@^3.3.1: resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz#00434f608b4e8df54c59e070efeefc37fb4bb859" protons@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/protons/-/protons-1.0.0.tgz#cf836223ddc727680abf872ffa1ae8f505826fa3" + version "1.0.1" + resolved "https://registry.yarnpkg.com/protons/-/protons-1.0.1.tgz#1c107144c07fc2d1cb8b6cb76451e6a938237676" dependencies: - brfs "^1.4.3" protocol-buffers-schema "^3.3.1" safe-buffer "^5.1.1" signed-varint "^2.0.1" varint "^5.0.0" -prr@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" - prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -7231,21 +7115,6 @@ quick-format-unescaped@^1.1.1: dependencies: fast-safe-stringify "^1.0.8" -quote-stream@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/quote-stream/-/quote-stream-1.0.2.tgz#84963f8c9c26b942e153feeb53aae74652b7e0b2" - dependencies: - buffer-equal "0.0.1" - minimist "^1.1.3" - through2 "^2.0.0" - -quote-stream@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/quote-stream/-/quote-stream-0.0.0.tgz#cde29e94c409b16e19dc7098b89b6658f9721d3b" - dependencies: - minimist "0.0.8" - through2 "~0.4.1" - randomatic@^1.1.3: version "1.1.7" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" @@ -7346,7 +7215,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@1.1.x, "readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@^1.0.33, readable-stream@^1.1.13-1, readable-stream@~1.1.9: +readable-stream@1.1.x, "readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@^1.0.33, readable-stream@^1.1.13-1: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" dependencies: @@ -7367,7 +7236,7 @@ readable-stream@2.3.3, readable-stream@^2.0.0, readable-stream@^2.0.2, readable- string_decoder "~1.0.3" util-deprecate "~1.0.1" -readable-stream@~1.0.15, readable-stream@~1.0.17, readable-stream@~1.0.2, readable-stream@~1.0.27-1: +readable-stream@~1.0.15, readable-stream@~1.0.17, readable-stream@~1.0.2: version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" dependencies: @@ -7432,8 +7301,8 @@ regenerator-runtime@0.10.5, regenerator-runtime@^0.10.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" regenerator-runtime@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" regenerator-runtime@^0.9.5: version "0.9.6" @@ -7673,7 +7542,7 @@ resolve@1.1.7, resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.1.7: +resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -7794,8 +7663,8 @@ scroll-to-anchor@^1.0.0: resolved "https://registry.yarnpkg.com/scroll-to-anchor/-/scroll-to-anchor-1.1.0.tgz#c99b8d2e5d95056752787ca78095ab75b520b3fd" secp256k1@^3.0.1, secp256k1@^3.3.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.3.1.tgz#d1d325519db714789c11ec0450d4b9a3aa01eb1a" + version "3.4.0" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.4.0.tgz#1c905b256fa4ae5b9cc170e672dd59b4c5de46a4" dependencies: bindings "^1.2.1" bip66 "^1.1.3" @@ -7804,7 +7673,6 @@ secp256k1@^3.0.1, secp256k1@^3.3.0: drbg.js "^1.0.1" elliptic "^6.2.3" nan "^2.2.1" - prebuild-install "^2.0.0" safe-buffer "^5.1.0" selenium-webdriver@3.6.0: @@ -7867,10 +7735,6 @@ sha3@^1.1.0: dependencies: nan "^2.0.5" -shallow-copy@~0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/shallow-copy/-/shallow-copy-0.0.1.tgz#415f42702d73d810330292cc5ee86eae1a11a170" - shasum@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" @@ -7966,8 +7830,8 @@ simple-get@^1.4.2: xtend "^4.0.0" simple-peer@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-8.1.1.tgz#71c475ad9f10da2f22e045d4ec2a1d282046ba23" + version "8.2.0" + resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-8.2.0.tgz#9cd002b33204e2791ea84e11bc75687d846cf604" dependencies: debug "^2.1.0" get-browser-rtc "^1.0.0" @@ -8167,11 +8031,7 @@ source-map@0.5.x, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, sourc version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" -"source-map@>= 0.1.2", source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -source-map@^0.1.38, source-map@~0.1.33: +source-map@^0.1.38: version "0.1.43" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" dependencies: @@ -8183,6 +8043,10 @@ source-map@^0.4.4, source-map@~0.4.0, source-map@~0.4.2: dependencies: amdefine ">=0.0.4" +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" @@ -8226,9 +8090,9 @@ split@0.3, split@~0.3.0: dependencies: through "2" -sprintf-js@^1.0.3: - version "1.1.1" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.1.tgz#36be78320afe5801f6cea3ee78b6e5aab940ea0c" +sprintf-js@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.0.tgz#cffcaf702daf65ea39bb4e0fa2b299cec1a1be46" sprintf-js@~1.0.2: version "1.0.3" @@ -8286,28 +8150,6 @@ statehood@^5.0.3: items "2.x.x" joi "10.x.x" -static-eval@~0.2.0: - version "0.2.4" - resolved "https://registry.yarnpkg.com/static-eval/-/static-eval-0.2.4.tgz#b7d34d838937b969f9641ca07d48f8ede263ea7b" - dependencies: - escodegen "~0.0.24" - -static-module@^1.1.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/static-module/-/static-module-1.5.0.tgz#27da9883c41a8cd09236f842f0c1ebc6edf63d86" - dependencies: - concat-stream "~1.6.0" - duplexer2 "~0.0.2" - escodegen "~1.3.2" - falafel "^2.1.0" - has "^1.0.0" - object-inspect "~0.4.0" - quote-stream "~0.0.0" - readable-stream "~1.0.27-1" - shallow-copy "~0.0.1" - static-eval "~0.2.0" - through2 "~0.4.1" - "statuses@>= 1.3.1 < 2": version "1.4.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" @@ -8700,13 +8542,6 @@ through2@^1.0.0: readable-stream ">=1.1.13-1 <1.2.0-0" xtend ">=4.0.0 <4.1.0-0" -through2@~0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/through2/-/through2-0.4.2.tgz#dbf5866031151ec8352bb6c4db64a2292a840b9b" - dependencies: - readable-stream "~1.0.17" - xtend "~2.1.1" - through@2, "through@>=2.2.7 <3", through@^2.3.6, through@~2.3, through@~2.3.1, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -8950,8 +8785,8 @@ unist-util-remove-position@^1.0.0: unist-util-visit "^1.1.0" unist-util-visit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.2.0.tgz#9dc78d1f95cd242e865f7f93f327d3296bb9a718" + version "1.3.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.3.0.tgz#41ca7c82981fd1ce6c762aac397fc24e35711444" dependencies: unist-util-is "^2.1.1" @@ -9032,7 +8867,7 @@ useragent@^2.1.12: lru-cache "2.2.x" tmp "0.0.x" -util-deprecate@^1.0.2, util-deprecate@~1.0.1: +util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -9233,11 +9068,11 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2" -widest-line@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-1.0.0.tgz#0c09c85c2a94683d0d7eaf8ee097d564bf0e105c" +widest-line@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.0.tgz#0142a4e8a243f8882c0233aa0e0281aa76152273" dependencies: - string-width "^1.0.1" + string-width "^2.1.1" window-size@0.1.0: version "0.1.0" From a576f1090e93c82848666cf55f62587cb6c42a0a Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 11 Dec 2017 17:10:54 +0000 Subject: [PATCH 5/9] fixes mime type default and charset --- add-on/src/lib/ipfs-protocol.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/add-on/src/lib/ipfs-protocol.js b/add-on/src/lib/ipfs-protocol.js index ccd0bf9a8..f69963902 100644 --- a/add-on/src/lib/ipfs-protocol.js +++ b/add-on/src/lib/ipfs-protocol.js @@ -13,9 +13,9 @@ exports.createIpfsUrlProtocolHandler = (getIpfs) => { const ipfs = getIpfs() try { - const {data, mimeType} = await getDataAndGuessMimeType(ipfs, path) - console.log(`[ipfs-companion] returning ${path} as ${mimeType}`) - reply({mimeType, data}) + const {data, mimeType, charset} = await getDataAndGuessMimeType(ipfs, path) + console.log(`[ipfs-companion] returning ${path} as mime ${mimeType} and charset ${charset}`) + reply({mimeType, data, charset}) } catch (err) { console.error('[ipfs-companion] failed to get data', err) reply({mimeType: 'text/html', data: `Error ${err.message}`}) @@ -37,13 +37,13 @@ async function getDataAndGuessMimeType (ipfs, path) { throw err } - const mimeType = mimeSniff(data, path) - return {mimeType, data: data.toString('utf8')} + const mimeType = mimeSniff(data, path) || 'text/plain' + return {mimeType, data: data.toString('utf8'), charset: 'utf8'} } async function getDirectoryListingOrIndexData (ipfs, path) { const listing = await ipfs.ls(path) - const index = listing.find((l) => ['index.html', 'index.htm'].includes(l.name)) + const index = listing.find((l) => ['index', 'index.html', 'index.htm'].includes(l.name)) if (index) { return getDataAndGuessMimeType(ipfs, PathUtils.joinURLParts(path, index.name)) From 4254fb21befd3ed1d44effbe26ba1eb6a8437270 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 12 Dec 2017 09:59:24 +0000 Subject: [PATCH 6/9] adds ipfs-protocol tests --- add-on/src/lib/ipfs-protocol.js | 6 ++- test/functional/lib/ipfs-protocol.test.js | 51 +++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test/functional/lib/ipfs-protocol.test.js diff --git a/add-on/src/lib/ipfs-protocol.js b/add-on/src/lib/ipfs-protocol.js index f69963902..b49fb1d4d 100644 --- a/add-on/src/lib/ipfs-protocol.js +++ b/add-on/src/lib/ipfs-protocol.js @@ -49,5 +49,9 @@ async function getDirectoryListingOrIndexData (ipfs, path) { return getDataAndGuessMimeType(ipfs, PathUtils.joinURLParts(path, index.name)) } - return {mimeType: 'text/html', data: dirView.render(path.replace(/^\/ipfs\//, 'ipfs://'), listing)} + return { + mimeType: 'text/html', + data: dirView.render(path.replace(/^\/ipfs\//, 'ipfs://'), listing), + charset: 'utf8' + } } diff --git a/test/functional/lib/ipfs-protocol.test.js b/test/functional/lib/ipfs-protocol.test.js new file mode 100644 index 000000000..82ae93f2b --- /dev/null +++ b/test/functional/lib/ipfs-protocol.test.js @@ -0,0 +1,51 @@ +'use strict' +const { describe, it } = require('mocha') +const { expect } = require('chai') +const { createIpfsUrlProtocolHandler } = require('../../../add-on/src/lib/ipfs-protocol') + +describe('ipfs-protocol', () => { + it('should serve an IPFS file', async () => { + const url = 'ipfs://QmQxeMcbqW9npq5h5kyE2iPECR9jxJF4j5x4bSRQ2phLY4' + const content = 'TEST' + Date.now() + const ipfs = { files: { cat: () => Promise.resolve(content) } } + const handler = createIpfsUrlProtocolHandler(() => ipfs) + const request = { url } + + const res = await new Promise(async (resolve, reject) => { + try { + await handler(request, resolve) + } catch (err) { + reject(err) + } + }) + + expect(res.data).to.equal(content) + }) + + it('should serve a directory listing', async () => { + const url = 'ipfs://QmQxeMcbqW9npq5h5kyE2iPECR9jxJF4j5x4bSRQ2phLY4' + const links = [ + { name: `one${Date.now()}`, size: Date.now() }, + { name: `two{Date.now()}`, size: Date.now() }, + { name: `three${Date.now()}`, size: Date.now() } + ] + const ipfs = { + files: { cat: () => Promise.reject(new Error('this dag node is a directory')) }, + ls: () => Promise.resolve(links) + } + const handler = createIpfsUrlProtocolHandler(() => ipfs) + const request = { url } + + const res = await new Promise(async (resolve, reject) => { + try { + await handler(request, resolve) + } catch (err) { + reject(err) + } + }) + + expect(res.mimeType).to.equal('text/html') + expect(res.charset).to.equal('utf8') + links.forEach((link) => expect(res.data).to.contain(`${url}/${link.name}`)) + }) +}) From a1f8cfeb7858a615101923e342db3aadc7f12b0d Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 12 Dec 2017 10:00:38 +0000 Subject: [PATCH 7/9] fixes test link name --- test/functional/lib/ipfs-protocol.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/lib/ipfs-protocol.test.js b/test/functional/lib/ipfs-protocol.test.js index 82ae93f2b..9a619efa2 100644 --- a/test/functional/lib/ipfs-protocol.test.js +++ b/test/functional/lib/ipfs-protocol.test.js @@ -26,7 +26,7 @@ describe('ipfs-protocol', () => { const url = 'ipfs://QmQxeMcbqW9npq5h5kyE2iPECR9jxJF4j5x4bSRQ2phLY4' const links = [ { name: `one${Date.now()}`, size: Date.now() }, - { name: `two{Date.now()}`, size: Date.now() }, + { name: `two${Date.now()}`, size: Date.now() }, { name: `three${Date.now()}`, size: Date.now() } ] const ipfs = { From bde168a7afb68e60220e1a4de455c9a08eb358a4 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Tue, 12 Dec 2017 11:15:12 +0000 Subject: [PATCH 8/9] removes hats from is-svg and tachyons --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 487c802f5..6e866d987 100644 --- a/package.json +++ b/package.json @@ -77,11 +77,11 @@ "ipfs": "0.27.3", "ipfs-api": "17.1.3", "is-ipfs": "0.3.2", - "is-svg": "^2.1.0", + "is-svg": "2.1.0", "lru_map": "0.3.3", "mime-types": "2.1.17", "prundupify": "1.0.0", - "tachyons": "^4.9.0", + "tachyons": "4.9.0", "webextension-polyfill": "0.1.2" } } From 1fed7b3f8b3c0aac2a7ae7a00691c6f99b845538 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 16 Dec 2017 15:31:38 +0100 Subject: [PATCH 9/9] Update yarn.lock --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 11d6c088f..8e96931ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4588,7 +4588,7 @@ is-stream@^1.0.0, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -is-svg@^2.1.0: +is-svg@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-2.1.0.tgz#cf61090da0d9efbcab8722deba6f032208dbb0e9" dependencies: @@ -5118,7 +5118,7 @@ level-js@^2.2.4: typedarray-to-buffer "~1.0.0" xtend "~2.1.2" -"level-js@github:timkuijsten/level.js#idbunwrapper": +level-js@timkuijsten/level.js#idbunwrapper: version "2.2.3" resolved "https://codeload.github.com/timkuijsten/level.js/tar.gz/18e03adab34c49523be7d3d58fafb0c632f61303" dependencies: @@ -5990,7 +5990,7 @@ multihashing-async@~0.4.6, multihashing-async@~0.4.7: murmurhash3js "^3.0.1" nodeify "^1.0.1" -"multiplex@github:dignifiedquire/multiplex": +multiplex@dignifiedquire/multiplex: version "6.7.0" resolved "https://codeload.github.com/dignifiedquire/multiplex/tar.gz/b5d5edd30454e2c978ee8c52df86f5f4840d2eab" dependencies: @@ -8394,7 +8394,7 @@ table@^4.0.1: slice-ansi "1.0.0" string-width "^2.1.1" -tachyons@^4.9.0: +tachyons@4.9.0: version "4.9.0" resolved "https://registry.yarnpkg.com/tachyons/-/tachyons-4.9.0.tgz#2df058ea6b6eb3d2be12d62a69fecb0f6b1e0534"