Skip to content

Commit

Permalink
chore: dependency bump
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Oct 11, 2020
1 parent 0a93d69 commit 7a2f7ed
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 85 deletions.
4 changes: 1 addition & 3 deletions add-on/src/lib/ipfs-client/external.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ log.error = debug('ipfs-companion:client:external:error')
const IpfsApi = require('ipfs-http-client')

exports.init = async function (opts) {
log(`init with API: ${opts.apiURLString}`)
log(`init with IPFS API at ${opts.apiURLString}`)

const url = opts.apiURL
const protocol = url.protocol.substr(0, url.protocol.length - 1) // http: -> http
Expand All @@ -20,5 +20,3 @@ exports.init = async function (opts) {
exports.destroy = async function () {
log('destroy')
}

// TODO: Upgrade to a caching proxy for ipfs-http-client
26 changes: 13 additions & 13 deletions add-on/src/lib/ipfs-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ const { precache } = require('../precache')
let client

async function initIpfsClient (opts) {
await destroyIpfsClient()
log('init ipfs client')
if (client) return // await destroyIpfsClient()
let backend
switch (opts.ipfsNodeType) {
case 'embedded':
client = embedded
backend = embedded
break
case 'embedded:chromesockets':
client = embeddedWithChromeSockets
backend = embeddedWithChromeSockets
break
case 'external':
client = external
backend = external
break
default:
throw new Error(`Unsupported ipfsNodeType: ${opts.ipfsNodeType}`)
}

const instance = await client.init(opts)
const instance = await backend.init(opts)
easeApiChanges(instance)
_reloadIpfsClientDependents(instance, opts) // async (API is present)
client = backend
return instance
}

async function destroyIpfsClient () {
log('destroy ipfs client')
if (client && client.destroy) {
try {
await client.destroy()
} finally {
client = null
await _reloadIpfsClientDependents() // sync (API stopped working)
}
if (!client) return
try {
await client.destroy()
await _reloadIpfsClientDependents() // sync (API stopped working)
} finally {
client = null
}
}

Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:copy": "run-s build:copy:*",
"build:copy:src": "shx mkdir -p add-on/dist && shx cp -R add-on/src/* add-on/dist",
"build:js": "run-s build:js:*",
"build:js:webpack": "webpack -p",
"build:js:webpack": "webpack",
"build:minimize-dist": "shx rm -rf add-on/dist/lib add-on/dist/contentScripts/ add-on/dist/bundles/ipfsProxyContentScriptPayload.bundle.js",
"build:bundle-all": "cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} run-s bundle:chromium bundle:brave:$RELEASE_CHANNEL bundle:firefox:$RELEASE_CHANNEL",
"build:rename-artifacts": "./scripts/rename-artifacts.js",
Expand Down Expand Up @@ -89,7 +89,7 @@
"css-loader": "4.3.0",
"download-cli": "1.1.1",
"fakefile": "0.0.10",
"file-loader": "6.1.0",
"file-loader": "6.1.1",
"firefox-addons-add-update-version": "1.0.1",
"fs-promise": "2.0.3",
"get-firefox": "4.0.0",
Expand All @@ -99,27 +99,27 @@
"ipfs-or-gateway": "2.1.0",
"json": "10.0.0",
"mem-storage-area": "1.0.3",
"mini-css-extract-plugin": "0.11.3",
"mini-css-extract-plugin": "1.0.0",
"mocha": "8.1.3",
"npm-run-all": "4.1.5",
"nyc": "15.1.0",
"raw-loader": "4.0.1",
"raw-loader": "4.0.2",
"request-progress": "3.0.0",
"shx": "0.3.2",
"simple-progress-webpack-plugin": "1.1.2",
"sinon": "9.1.0",
"sinon": "9.2.0",
"sinon-chrome": "3.0.1",
"standard": "14.3.4",
"style-loader": "1.3.0",
"style-loader": "2.0.0",
"tar": "6.0.5",
"terser": "5.3.4",
"terser-webpack-plugin": "4.2.2",
"terser-webpack-plugin": "4.2.3",
"transform-loader": "0.2.4",
"web-ext": "5.2.0",
"webpack": "4.44.2",
"webpack-bundle-analyzer": "3.9.0",
"webpack-cli": "3.3.12",
"webpack-merge": "5.1.4"
"webpack-merge": "5.2.0"
},
"dependencies": {
"@material/switch": "7.0.0",
Expand All @@ -146,6 +146,7 @@
"it-tar": "1.2.2",
"lru-cache": "6.0.0",
"merge-options": "3.0.3",
"mortice": "2.0.0",
"multiaddr": "8.0.0",
"multiaddr-to-uri": "6.0.0",
"p-memoize": "4.0.1",
Expand Down
Loading

0 comments on commit 7a2f7ed

Please sign in to comment.