Skip to content

Commit 33b41ca

Browse files
authored
update get-ipfs and provide specific peers for browser vs local nodes (#28)
1 parent 4b21b1f commit 33b41ca

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ A front end application to demonstrate portable user settings through IPFS. Chan
2121
## Environment
2222
```
2323
REACT_APP_DEFAULT_CID = QmUWWqCNSdZmus7mc52um5cpqUi1CaE97AzBTY7iWfBXV9
24-
REACT_APP_BOOTSTRAP_NODE = /dns4/ipfs.runfission.com/tcp/4003/wss/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw
24+
REACT_APP_BOOTSTRAP_NODE_TCP = /ip4/3.215.160.238/tcp/4001/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw
25+
REACT_APP_BOOTSTRAP_NODE_WSS = /dns4/ipfs.runfission.com/tcp/4003/wss/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw
2526
REACT_APP_INTERPLANETARY_FISSION_URL = https://runfission.com
2627
REACT_APP_INTERPLANETARY_FISSION_USERNAME = ADD_USERNAME_HERE
2728
REACT_APP_INTERPLANETARY_FISSION_PASSWORD = ADD_PASSWORD_HERE
2829
```
2930

3031
`REACT_APP_DEFAULT_CID`: the cid that contains the default settings that you want a new user to see. You can set it to the above value for our recommended defaults (or leave it blank and it will default to that).
3132

32-
`REACT_APP_BOOTSTRAP_NODE`: the multiaddr of the ipfs node that you would like the user's node to connect to. You can set it to the above value to connect to the IPFS node that Fission hosts (or leave it blank and it will default to that).
33+
`REACT_APP_BOOTSTRAP_NODE_TCP`: the multiaddr of the ipfs node that you would like the user's node to connect to through tcp (for instance with a local daemon through ipfs companion). You can set it to the above value to connect to the IPFS node that Fission hosts (or leave it blank and it will default to that).
3334

34-
**Note:** if you use a custom node, it must be interoperable with `js-ipfs`. This means that it either needs to connect via WebRTC or Secured Websockets (notice the `wss` in the above multiaddr).
35+
`REACT_APP_BOOTSTRAP_NODE_WSS`: the multiaddr of the ipfs node that you would like the user's node to connect to through wss (if the user does not have an ipfs-enabled browser and falls back to an in-browser js-ipfs daemon). You can set it to the above value to connect to the IPFS node that Fission hosts (or leave it blank and it will default to that). **Note:** if you use a custom node, it must be interoperable with `js-ipfs`. This means that it either needs to connect via WebRTC or Secured Websockets (notice the `wss` in the above multiaddr).
3536

3637
`REACT_APP_INTERPLANETARY_FISSION_...`: the last three variables are your provisioned account information for using the Fission web-api. These are used for pinning content to the Fission IPFS node so that content will stay online even after a user goes offline. If you leave them blank, the webapp will not pin user content. At the moment, these can be obtained by joining the [Fission Heroku add-on alpha](https://elements.heroku.com/addons/interplanetary-fission).
3738

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@material-ui/icons": "^4.2.1",
1111
"classnames": "^2.2.6",
1212
"eslint-utils": "1.4.2",
13-
"get-ipfs": "^0.0.3",
13+
"get-ipfs": "^1.0.0-rc",
1414
"gh-pages": "^2.1.1",
1515
"prop-types": "^15.7.2",
1616
"react": "^16.9.0",

src/ipfs/preferences.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ const ipfsProvider =
55
process.env.REACT_APP_INTERPLANETARY_FISSION_URL || "https://hostless.dev";
66
const username = process.env.REACT_APP_INTERPLANETARY_FISSION_USERNAME;
77
const password = process.env.REACT_APP_INTERPLANETARY_FISSION_PASSWORD;
8-
const bootstrapNode =
9-
process.env.REACT_APP_BOOTSTRAP_NODE ||
8+
const bootstrapNodeWSS =
9+
process.env.REACT_APP_BOOTSTRAP_NODE_WSS ||
1010
"/dns4/ipfs.runfission.com/tcp/4003/wss/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw";
11+
const bootstrapNodeTCP =
12+
process.env.REACT_APP_BOOTSTRAP_NODE_TCP ||
13+
"/ip4/3.215.160.238/tcp/4001/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw";
14+
1115

1216
export const DefaultCid =
1317
process.env.REACT_APP_DEFAULT_CID ||
1418
"QmUWWqCNSdZmus7mc52um5cpqUi1CaE97AzBTY7iWfBXV9";
1519

1620
const getIpfs = async () => {
1721
return getIpfsWithConfig({
18-
bootstrap: [bootstrapNode]
22+
localPeers: [bootstrapNodeTCP],
23+
browserPeers: [bootstrapNodeWSS]
1924
});
2025
};
2126

0 commit comments

Comments
 (0)