Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

fix: ipfs api name and doUpdateIpfsApiAddress #36

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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 })
}
Expand Down