From 407d3ad11968b70296a356e05666a6ca5d03e53b Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 10 Nov 2019 20:14:04 +0000 Subject: [PATCH] fix: ipfs api name and doUpdateIpfsApiAddress License: MIT Signed-off-by: Henrique Dias --- package-lock.json | 4 ++-- src/index.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 47cbe08..3c5be8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5331,7 +5331,7 @@ "buffer": "^5.4.2", "callbackify": "^1.1.0", "cids": "~0.7.1", - "concat-stream": "github:hugomrdias/concat-stream#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034", + "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", "debug": "^4.1.0", "delay": "^4.3.0", "detect-node": "^2.0.4", @@ -5367,7 +5367,7 @@ "multibase": "~0.6.0", "multicodec": "~0.5.1", "multihashes": "~0.4.14", - "ndjson": "github:hugomrdias/ndjson#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11", + "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", "once": "^1.4.0", "peer-id": "~0.12.3", "peer-info": "~0.15.1", diff --git a/src/index.js b/src/index.js index 9802ac7..5c3b559 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ /* eslint-env browser, webextensions */ const root = require('window-or-global') -const IpfsApi = require('ipfs-http-client') +const httpClient = require('ipfs-http-client') const tryCompanion = require('./companion') const tryWindow = require('./window.ipfs') const tryApi = require('./js-ipfs-api') @@ -113,7 +113,7 @@ module.exports = (opts) => { }, doUpdateIpfsApiAddress: (addr) => (store) => { - if (!isMultiaddress(addr)) { + if (!isMultiaddress(addr) && !isURL(addr)) { store.dispatch({ type: 'IPFS_API_ADDRESS_INVALID' }) return } @@ -151,7 +151,7 @@ async function getIpfs (opts, { store, getState, dispatch }) { if (opts.tryApi) { const { apiAddress, defaultApiAddress } = getState().ipfs const { location } = root - const res = await tryApi({ apiAddress, defaultApiAddress, location, IpfsApi, ipfsConnectionTest }) + const res = await tryApi({ apiAddress, defaultApiAddress, location, httpClient, ipfsConnectionTest }) if (res) { return dispatch({ type: 'IPFS_INIT_FINISHED', payload: res }) }